Colord is a tiny color manipulation and conversion tool
Features
- π¦ Small: Just 1.5 KB gzipped (3+ times lighter than color and tinycolor)
- π Fast: ~50% faster than color and tinycolor
- π Simple: Chainable API and familiar patterns
- πͺ Immutable: No need to worry about data mutations
- π‘ Bulletproof: Written in strict TypeScript and 100% covered by tests
- π Typed: All types are available out of the box
- π Extendable: Built-in plugin system to add new functionality
- π« Works everywhere: Supports all browsers and Node 12+
- π¨ Zero-dependency
Benchmarks
Name | ops/sec (millions) | Size | Size (gzip) | Dependencies |
---|---|---|---|---|
colord | 1 692 690 | |||
tinycolor2 | 998 946 | |||
color | 736 610 |
Performance results were generated on a MBP 2019, 2,6 GHz Intel Core i7. To perform these tests, execute npm run benchmark
in the library folder.
Roadmap
- [x] Parse and convert Hex, RGB(A), HSL(A), HSV(A)
- [x] Saturate, desaturate, grayscale
- [x] Trim an input value
- [x] Clamp input numbers to resolve edge cases (e.g.
rgb(256, -1, 999, 2)
) - [x]
brightness
,isDark
,isLight
- [x] Set and get
alpha
- [x] Plugin API
- [x] 4 and 8 digit Hex
- [x]
lighten
,darken
- [x]
invert
- [x] CSS color names (via plugin)
- [ ] A11y and contrast utils (via plugin)