1.0.0 • Published 7 years ago

color-extract v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

Color Extract

Fetch prominent colors from images.

# Extract color schemes via terminal.
# If --clusters is not defined, the getProminentColors is used
$ npm install -g color-extract
$ color-extract --input '/path/to/some/file.png' --number 3 --clusters
# Prints ["#141CFC","#04FC7C","#FC2404"]
// Use it via the module.
import { getKMeansColors, getProminentColors } from 'color-extract';
getKMeansColors('/path/to/some/file.png', 3) .then(colors => winston.info(colors.colors))
getProminentColors('/path/to/some/file.png', 3).then(colors => winston.info(colors.colors));

// Top = true: Will seperate the color on the top line of the image.
// This option is only available in getProminentColors, not in getKMeansColors.
getProminentColors('/path/to/some/file.png', 3, true).then((colors) => {
  winston.info(colors.top);
  winston.info(colors.colors);
});