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 support