This fork allows white color and uses 3 or 4 channels raw data for input
var ColorThief = require('color-thief-raw');
// getColor(sourceImage[, quality])
// sourceImage = {
// data: [...], // 3 or 4 channels raw data
// info: {
// width: imageWidth,
// height: imageHeight,
// channels: numberOfChannels
// }
// }
var dominantColor = ColorThief.getColor(sourceImage);
// dominantColor = [intRed, intGreen, intBlue]In this example, we build an 8 color palette.
var ColorThief = require('color-thief-raw');
// getPalette(sourceImage[, colorCount, quality])
var palette = ColorThief.getPalette(sourceImage, 8);
// palette = [ [intRed, intGreen, intBlue], [intRed, intGreen, intBlue], ... ]Source code based on
color-thief (MIT license) by Lokesh Dhakar lokeshdhakar.com
color-thief-jimp (MIT license) by Jean-Matthieu DECHRISTÉ