Extract colors

Javascript library to extract color palette from images simple, fast and lightweight
support browser and Node.js

Image example
Loading image

Random image from Unsplash

Getting started

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)

🚀 Performant

This script use two pass. The first optimize calculation to reduce time. The second sort colors with precise calculations.

🌐 Browser & NodeJs

Core function are similar for NodeJs and browser. Extract Colors expose multiple export: browser, NodeJs and ECMAScript Modules.

Typescript support

Fully coded in Typescript to take advantage of typing.

🪡 Fine-grained control

All the options allow you to precisely parameterize the calculations.

Support

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+