Releases: color-js/color.js
v0.2.4
v0.2.3
v0.2.2
Fixed two bugs:
- Fixed regression with the fallback parameter in
serialize()
/color.toString()
- Precision in
serialize()
/color.toString()
now applies to alpha too
Full Changelog: v0.2.1...v0.2.2
v0.2.1
v0.2.0 - Optional tree-shakeable API!
While we were hoping that the previous release would be the last one done before Color.js is "officially" released in the wild, we ended up making some more big changes before this happens, but for a very good reason.
The biggest change in this release is that all internals have been rewritten to provide an alternative API that is procedural and thus, tree-shakable. It is also faster because it can operate on plain objects instead of Color
objects. You can read more about how this works in the docs. Color spaces are still not tree-shakeable, see #163.
If you prefer the OO API, you can continue using it, it is not going anywhere!
Other breaking changes
Leanness has been a focus of this release, so we removed a lot of cruft that did not make sense or was superfluous.
src/main.js
has been renamed tosrc/index.js
defaults.gamutMapping
is nowdefaults.gamut_mapping
and we plan to generally use underscore_case for config options going forward.- The
color.lightness
,color.chroma
andcolor.hue
accessors that were previously deprecated are now removed. - The legacy
Color.space()
alias is now removed. Just useColor.Space.get()
. - Removed
Color.convert()
, see #153 Color.inGamut()
is now a consistent static version ofcolor.inGamut()
. Previously it had an entirely different signature.new Color("--foo" [, element])
syntax has been removed, see #160 for details.new Color(coords [,alpha])
signature which assumed sRGB has been removed. Just provide the color space explicitly.color.white
getter has been removed. Just usecolor.space.white
.- The fallback parameter in
color.toString()
/serialize()
has been simplified to take a single color space instead of an array. Similarly,defaults.fallbackSpaces
has been removed, there is now only adefaults.css_space
that is set upon startup and can be overridden.
Other changes and fixes
- New
ColorSpace#to(color)
signature - New
ColorSpace#from(space, coords)
/ColorSpace#from(color)
method b130d02 ColorSpace.get()
now accepts alternatives, e.g. you can doColorSpace.get("oklch", "lch")
to get oklch if available, or lch otherwise.- Fixed ACEScc range #157
Acknowledgements
We'd like to thank @ai for his help and encouragement wrt making Color.js tree-shakeable! (#159)
Full Changelog: v0.1.0...v0.2.0
v0.1.0 - Candidate public release
Lots of breaking changes in this release, so be careful when upgrading from v0.0.x!
- Major refactor of the API and internals after our experience drafting a Color API for the Web Platform. The main changes are:
- #113 Color spaces are now defined by
ColorSpace
objects with abase
property, which creates a tree of color spaces. Conversions between spaces now use the lowest common ancestor in the tree as a connection space, eliminating the need for custom pre-computed "shortcuts" for conversions - #144 Breaking change: Instead of long-form coordinate names like
hue
,chroma
,lightness
, we now use shorter ones likeh
,c
,l
. The longer names are still there as metadata, which can be useful for generating UIs (such as this generic color picker for any color space! - #111
color.get(coordRef)
,color.getAll(spaceRef)
,color.set(coordRef, coorde)
,color.setAll(spaceRef, coords)
for reading/setting coords in any color space. These are faster, and more flexible. The previous syntax (color.spaceId.coordId
) is still available, but has been moved to a plugin and is not used internally (which should improve performance of a variety of functions). Color.defineSpace()
is nowColorSpace.register()
(with different params)- Due to the way color spaces are now defined, we have added linear versions of every RGB space (and ACEScg which is the linear version of ACEScc)
- #113 Color spaces are now defined by
- #152 Breaking change:
color.toGamut()
now performs in-place modification. Clone the color first if you want the old behavior:color.clone().toGamut()
- #145 Breaking change:
color.spaceId
andcolor.space
are now immutable which helps performance - Breaking change: Trimmed down the API and removed methods that were hardly ever used:
color.getCoords({inGamut, precision})
util.value()
,util.capitalize()
,util.extend()
- Breaking change: #147 Removed
color.hue
,color.chroma
,color.lightness
as well asColor.shortcuts
that defined these. Now the color space for these needs to be explicitly defined. More details on the reasoning in #147. - Breaking change: #148 Default output space for interpolation is now the interpolation space instead of the first color's color space
- CSS-like functional formats are now defined by CSS-like grammars such as
["<number> | <angle>", "<percentage>", "<percentage>"]
- Breaking change:
fallback
parameter incolor.toString()
is now simplified to be either a boolean or a color space reference, no arrays.Color.defaults.fallbackSpaces
is now removed,Color.defaults.css_color
is automatically populated from a predefined list oflab
,rec2020
,p3
,srgb
based on what the current browser supports (orsrgb
if there no browser). - #155 Fixes to make Color.js usable on Node
- Breaking change:
dist/
files renamed (and their.min
versions):dist/color.esm.js
is nowdist/color.js
dist/color.js
is nowdist/color.global.js
dist.color.cjs.js
is nowdist/color.cjs
- Also lots of other bugfixes, test fixes, demo fixes, docs fixes
Full Changelog: v0.0.7...v0.1.0
Tree of color spaces we supportv0.0.7
v0.0.6
What's Changed
- Parse
oklch()
andoklab()
functional forms - Output
oklch()
andoklab()
instead ofcolor(...)
for OKLCH and OKLab colors - Typo OKCH > OKLCH by @ai in #133
- Move acorn to devDependencies by @ai in #131
- Fix circular reference by @facelessuser in #138
Full Changelog: v0.0.5...v0.0.6
v0.0.5
What's Changed
- Fix DeltaEJz algorithm by @facelessuser in #90
- [Doc][Adaptation] fix CAT example by @Ayc0 in #117
- [Doc][Adaptation] fix XYZ example by @Ayc0 in #118
- Reduce npm package size by @ai in #126
- Remove
.min
files from npm package by @ai in #129 - Fix .min cleaning and remove IIFE builds by @ai in #130
New Contributors
Full Changelog: v0.0.4...v0.0.5
v0.0.4
What's Changed
- Support for OKLab and OKLCH (color spaces) and deltaEOK (deltaE method)
- Experimental ACEScc implementation
- Fix typos: self -> this by @facelessuser in #61
- chore: use conditional package.json exports by @kripod in #62
- Fix algorithmic asymmetry by @facelessuser in #65
- Fix HSV to HSL conversion by @facelessuser in #68
- Fix conversion issues with HWB and HSL by @facelessuser in #79
- Acquire luminance from XYZ D65 to match WCAG 2.0 more correctly by @facelessuser in #83
- Fix error in Delta E algorithm by @facelessuser in #85
- get: use the actual package name by @Artoria2e5 in #94
- Fix comparison inconsistencies by @facelessuser in #80
- package.json: Remove duplicate wrong "main" by @Artoria2e5 in #97
- docs: minor non-content fixes in color-difference.md by @micgro42 in #88
- Pass epsilon to spaces that redirect the inGamut check by @facelessuser in #73
- Various bugfixes and improvements to the math
New Contributors
- @facelessuser made their first contribution in #61
- @kripod made their first contribution in #62
- @Artoria2e5 made their first contribution in #94
- @micgro42 made their first contribution in #88
Full Changelog: v0.0.3...v0.0.4