| Name | Modified | Size | Downloads / Week |
|---|---|---|---|
| Parent folder | |||
| README.md | 2026-02-28 | 2.7 kB | |
| v.2.7.0 source code.tar.gz | 2026-02-28 | 508.3 kB | |
| v.2.7.0 source code.zip | 2026-02-28 | 521.6 kB | |
| Totals: 3 Items | 1.0 MB | 3 | |
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