dominant-colors
v1.0.5
Published
A library that excepts an image and a number n and displays n dominant colors for this image.
Downloads
8
Readme
dominant-colors
General
Get dominant colors for images.
Author: [email protected]
Maintainer: [email protected]
Install
npm install dominant-colors
Usage
// import dominant-colors
const dominantColors = require('dominant-colors');
// imageUrl - path to the image
// maxColorNumber - number of dominant colors to display (up to 12 colors)
dominantColors.showColors(imageUrl, maxColorNumber)
.then(colors => {
// colors is an array of hsla color codes
// for example: ['hsla(0, 0%, 0%, 1)', 'hsla(0, 0%, 100%, 1)'];
})
.catch(error => {
// handle error
});