Color Thief

lokeshdhakar.com ↗

Extract image palettes with sampling, crop and colour-space controls.

SI Score
80/100
Pricing
Open Source AI reading, not confirmed
Free plan
Yes AI reading, not confirmed
Sign-up required
Not confirmed

Ask SI about Color Thief

Answers use saved listing facts and recorded sources.
Homepage screenshot
Screenshot of the Color Thief homepage

What it does

Color Thief extracts dominant colours and palettes through JavaScript. It also follows video frames and returns swatches with text-colour suggestions.

Install colorthief and pass an image into a palette function. Set the colour count, sampling rate or crop region, then read hex, RGB or CSS values from the returned objects.

Lower quality numbers inspect more pixels and take longer. Current palettes use OKLCH by default, with RGB available as an alternative. Video observation supports throttled updates; stop its controller when finished.

Node processing needs the asynchronous functions and the Sharp dependency. Wide-gamut extraction is browser-only; Node output uses sRGB.

The MIT-licensed code can be incorporated into a product while retaining its notices.

Strengths

  • Region controls isolate a relevant part of an image.

Watch out for

  • Synchronous extraction accepts browser sources only.

Best for

  • Image-driven interface colours

Sources