Releases: lokesh/color-thief
Releases · lokesh/color-thief
v3.3.0
v3.2.0
Browser bundlers no longer warn about sharp - Bundlers like webpack (Angular), Vite, and Rollup previously emitted a "Can't resolve 'sharp'" warning when using colorthief in browser-only projects. The library now ships separate browser builds that contain no references to sharp or Node.js-specific code. Bundlers automatically pick the right build via the "browser" condition in package.json exports. No changes needed on your end. The API is identical. (#279)
v3.1.0
v3.0.0
Full TypeScript rewrite with a unified browser + Node.js API.
Highlights:
- Rich Color objects with .hex(), .rgb(), .hsl(), .oklch(), .css()
- OKLCH perceptually uniform quantization
- Semantic swatches (Vibrant, Muted, DarkVibrant, DarkMuted, LightVibrant, LightMuted)
- Live extraction with observe() for video, canvas, and img elements
- Web Worker offloading
- Progressive 3-pass extraction
- WCAG contrast ratios and text color recommendations
- AbortSignal support
- Zero runtime dependencies
v.2.7.0
New features:
- Configurable pixel filtering — New options: ignoreWhite, whiteThreshold, alphaThreshold, and minSaturation let callers control which pixels are
included in color extraction - Options object API — getColor and getPalette now accept an options object (e.g., { colorCount: 5, quality: 10, ignoreWhite: false }) in addition to the
existing positional arguments - New browser input types — getPalette/getColor now accept HTMLCanvasElement, ImageData, and ImageBitmap in addition to HTMLImageElement
- TypeScript type definitions — Added .d.ts files for both browser (color-thief.d.ts) and Node (color-thief-node.d.ts)
Bug fixes & robustness:
- Fallback color for edge cases — New computeFallbackColor() averages all pixels when the quantizer can't produce a palette (e.g., solid-color or
all-white images), preventing null returns - Progressive filter relaxation — If filtering removes all pixels, filters are progressively relaxed (first allowing white, then transparent) before
falling back - Fixed variable scope leak — i in getImageData changed from implicit global to let
- Input validation — Browser version now throws descriptive errors for unloaded images, missing sources, and CORS-tainted canvases
- Null-safe palette access — All call sites now check palette for null before accessing palette[0]
Chores & tooling:
- Removed file-type dependency from Node version (unused)
- Removed dist/ from git tracking (kept in npm package via .npmignore)
- Added GitHub Actions CI workflow
- Replaced CanvasImage class with a simpler getPixelData() function
- Updated README to reflect current project setup
- Version bump to 2.7.0 across package.json and source files
v2.6.0
What's Changed
- deps: switch get-pixels for ndarray-pixels in #263
Original PR by @briandonahue #254
Full Changelog: v2.5.0...v2.6.0
v2.5.0
What's Changed
- src: refactor
color-thief-node.jsby @VoltrexKeyva in #209 - build: remove unused node-minify deps by @lokesh in #235
- feat: Pass mimetype when input is Buffer by @lokesh in #236
- build: file-type dep downgrade by @lokesh in #237
- dep: upgrade quantize to 1.4.0 by @lokesh in #262
- dev -> master by @lokesh in #234
New Contributors
- @VoltrexKeyva made their first contribution in #209
Full Changelog: v2.4.0...v2.5.0
v2.4.0
v2.3.2
v2.3.1
- #191 fix: quality option validation. Thanks to @aaron-hanson Issue
- chore: Fix npm script command syntax. Thanks again to @aaron-hanson
- tests: Add test for CORS
- docs: Move contributing info inline in README. Add proj structure and more info around testing.
