We hear you, it’s been a while, and v0.6.0 is long overdue. Assuming any significant issues come up in this beta, we plan to release a stable v0.6.0 in 1-2 weeks or so.
⬇️ 84 million downloads!
Color.js is quickly becoming the de facto color handling library for JS:
it has now been downloaded over 84 million times on npm,
a number that is rapidly increasing, at the rate of nearly 3 million downloads per week!
As a reminder, we recently started an Open Collective so you can fund Color.js's development.
If your company depends on Color.js in any way, it is in your best interest to ensure its future is sustainable.
Changes
Note
This only includes the changes after v0.6.0 Alpha 1.
Check out the v0.6.0 Alpha 1 release notes for changes since 0.5.2
API changes for DX
- A common request has been a function that gracefully parses colors, without throwing if there is an error. This version adds exactly that:
tryColor()
/Color.try()
(by @LeaVerou in #664) - A common use case was to use the procedural API for tree-shaking and performance, but still import all color spaces that Color.js supports. This is now made much easier, through the new
spaces
export of/fn
and the new/spaces
top-level export. (by @LeaVerou in #663, with types by @MysteryBlokHed in #668) - New
/src
export to import Color.js's source code directly (by @LeaVerou in #663, with types by @MysteryBlokHed in #668)
API changes for spec compliance
- Change
color(ictcp ...)
toictcp(...)
per CSS Color HDR (by @svgeesus in #646) - Change
color(jzazbz ...)
tojzazbz(...)
, andcolor(jzczhz ...)
tojzczhz(...)
per CSS Color HDR (by @svgeesus in #647) - Unprefix
display-p3-linear
since it is now in CSS Color 4 (i.e.color(--display-p3-linear ...)
→color(display-p3-linear ...)
(by @svgeesus in c90fe38). Not a breaking change, as both are still supported. - Use gamma 2.40 for display-referred
rec2020
; rename previous implementation as scene-referred--rec2020-oetf
(by @svgeesus in #669) - Make HSL parsing spec-compliant (by @kleinfreund in #650)
Bug fixes
- CAM16 and HCT hues are now correctly set to
null
when chroma is near zero (by @facelessuser in #644) - Fix issues with creating custom color spaces (by @sidewayss and @LeaVerou in #628)
- Don't clamp negative values in Absolute XYZ D65 (by @svgeesus in #613)
- Adjust calculations in Jzazbz and fix Jzazbz and JzCzhz reference ranges (by @svgeesus in #634 #635)
- Ensure Prophoto and Rec2020 spaces handle negative values (by @lloydk in #640)
- Don't throw for unknown coords when space accessors are used (by @LeaVerou)
- In
toGamut()
, better handle the case when JND equals 0 (by @facelessuser in #659)
Improvements to types
- Overload
multiplyMatrices
types and update implementation to pass all tests (by @epsilonError in #580 #631) - Fix CAM16 and HCT type errors (by @lloydk and @MysteryBlokHed in #622)
- Fix different types and type errors (by @lloydk in #642)
- Fix space accessor types to allow
null
(by @lloydk) - Fix return types of the
darken()
/lighten()
functions on theColor
class (by @lloydk in #654)
For contributors
- Testsuite & test coverage improvements (by @epsilonError in #594 and @svgeesus in f02ce7f)
Full Changelog: v0.6.0-alpha.1...v0.6.0-beta.1
New Contributors
- @sidewayss made their first contribution in #628
- @kleinfreund made their first contribution in #650
- @drwpow made their first contribution in #656