v0.7.0-alpha.2 #751
LeaVerou
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
⬇️ Over 220 million downloads! 🤯
This is the second pre-release of v0.7.0, with several new color spaces, and other improvements.
For the changes in v0.7.0-alpha.1, see the previous release notes.
As a reminder, we recently started an Open Collective that you can fund directly.
If your company depends on Color.js in any way, it is in your best interest to ensure its future is sustainable.
🚨 Breaking changes
These are unlikely to break things for the majority of users, but theoretically could if you were doing weird stuff with Color.js 😜.
We cleaned up
dist/quite a bit with this release and re-evaluated what actually needs to be there:src/. This also fixes a dual-instance bug where importing fromsrc/vs. the package root could yield differentColorregistries (by @LeaVerou in Remove ESM bundles and point to source directly #739)..min.*files from the package, since packages are moving away from providing these and minification is becoming a consumer concern (by @LeaVerou in Remove minified files from dist/ #741).For those of you that have been importing files directly from
colorjs.io, removed files now redirect to the versions still there (e.g.colorjs.io/dist/color.min.jsandcolorjs.io/dist/color.jsnow both redirect tocolorjs.io/src/color.js), so your code should continue to work.Improvements
New features
c = 1is the most colorful in-gamut color at a given lightness and hue so you never have to worry about getting out of gamut! These new spaces are:oklch-p3,oklch-srgb,oklch-rec2020,lch-p3,lch-srgb,lch-rec2020.GamutRelativeColorSpaceclass that can be easily used to generate such color spaces for any gamut and color space, as long as there is a coordinate to reduce that is guaranteed to get you in-gamut.display()fallback When a color isn't natively supported by the browser,display()now stays as close as possible to the original color: it walks up the base color space chain (closest first) and uses the first supported ancestor, preserving the color's gamut (e.g. anhsl-p3color falls back tocolor(display-p3 …)rather thanlab()) instead of always jumping to the widest default. Adds an opt-indisplaySpacesoverride onColorSpace, a parameterizablesupports(), and aDisplayOptionsinterface (by @LeaVerou in Smarterdisplay()fallback: base color space chain &displaySpaces#738)For plugin/library/tooling authors
Exposed more internals, so you never have to duplicate stuff that Color.js already knows about:
ColorSpace.MColor spaces now expose the transformation matrices they use internally through a newMproperty, so consumers can reuse them instead of duplicating the data. Matrices for RGB spaces can also be supplied via the genericMoption (by @LeaVerou in Expose color space transformation matrices via ColorSpace.M #749)inv(matrix inversion) andsolveto the math utilities, so external libraries are no longer required when developing new color spaces (by @facelessuser)Bug fixes & performance
toBase/fromBasewhen options omit them, instead of clobbering prototype methods withundefined(by @LeaVerou)Full Changelog: v0.7.0-alpha.1...v0.7.0-alpha.2
This discussion was created from the release v0.7.0-alpha.2.
Beta Was this translation helpful? Give feedback.
All reactions