Color-thief

color-thief

Grab the color palette or dominant color from an image!

color-thief helps to grab get the dominant color or the color palette from an image, this module makes use of JS, some cool math and the canvas tag to make it happen.

Get it: npm install --save color-thief

Sample usage:

1
2
3
4
5
6
7
var colorThief = new ColorThief();
colorThief.getColor(sourceImage);

/*
getColor(sourceImage[, quality])
returns {r: num, g: num, b: num}
*/
1
2
3
4
5
6
7
var colorThief = new ColorThief();
colorThief.getPalette(sourceImage, 8);

/*
getPalette(sourceImage[, colorCount, quality])
returns [ [num, num, num], [num, num, num], ... ]
*/

GIF FTW!

color-thief

Suggest a module

Comments