Javascript library to extract color palette from images simple, fast and lightweight
support browser and Node.js
Random image from Unsplash
Install Extract Colors on your project with NPM
npm install extract-colors
Extract color palette with the followed code
import { extractColors } from 'extract-colors'
const src = 'my-image.jpg'
extractColors(src)
.then(console.log)
.catch(console.error)
This script use two pass. The first optimize calculation to reduce time. The second sort colors with precise calculations.
Core function are similar for NodeJs and browser. Extract Colors expose multiple export: browser, NodeJs and ECMAScript Modules.
Fully coded in Typescript to take advantage of typing.
All the options allow you to precisely parameterize the calculations.
Firefox 29+
Chrome 33+
Edge 12+
Opera 19+
Safari 8+
Webview Android 4.4.3+
Samsung Internet 2.0+
Internet Explorer
Node.js 6.0+