Releases: Evercoder/culori
Releases · Evercoder/culori
v4.0.1
v4.0.0
Breaking changes
This release includes changes to how color strings are parsed, converted, and serialized, for better alignment to CSS specs:
- Clamp alpha to the
[0, 1]
interval at parse-time. - Clamp L in
lab()
/lch()
to[0, 100]
, inoklab()
/oklch()
to[0, 1]
at parse-time. - Correct numeric ranges in
hsl()
andhwb()
syntaxes from[0, 1]
to[0, 100]
. - Serialize missing components as
0
in legacy syntaxes and asnone
in modern syntaxes. - Use
0
for missing components in all color space conversions and gamut mapping functions.
New features
- Adds the ICtCp color space, part of CSS Color HDR Module Level 1, with the name
itp
; - Adds the ΔEITP color difference function as
differenceItp()
.
Fixes
- Make
averageAngle()
always return in the[0, 360]
interval; - Fix CIELUV (
luv
) conversion forl = 0
; - Allow CommonJS bare import
const culori = require('culori')
(in addition to the previousculori/require
endpoint).
v3.3.0
New features
- Adds a third parameter to
clampChroma()
to change the destination RGB gamut (#212, #213) - Adds the ability to bypass the JND part of the CSS Color Level 4 gamut mapping algorithm by passing
null
as thedelta
color difference function (#212, #213) - Adds the
easingSmoothstepInverse()
function (re: #207)
Bug fixes
- Updates the sRGB inverse transfer function to match the CSS spec (see w3c/csswg-drafts#9467)
v3.2.0
v3.1.3
v3.1.2
v3.1.1
v3.1.0
New features
This release introduces new gamut-related functions:
inGamut(mode)
returns a function with which to check that a color is within the gamut of themode
color space (#161); similar todisplayable()
, but for any RGB-based color space.clampGamut(mode)
returns a function with which to clip a color to the gamut of themode
color space; similar toclampRgb()
but for any RGB-based color space.toGamut(mode, ...)
returns a function to gamut-map a color to themode
color space (#168); similar toclampChroma
but for any RGB-based color space.
Bug fixes
Fixes mapper()
function when mode = null
(See #194, thanks @bijela-gora!)
v3.0.1
v3.0.0
Breaking changes
This new release includes revamped color parsing to align with the latest css-color-4
spec. Regular expression matching has been replaced with a parser that follows the css-syntax
spec more closely.
The new parser is more flexible with some aspects and stricter with others:
- Trickier whitespace formulas around numbers, such as
rgb(1-.2.3)
, are now properly handled (#187) - All non-legacy syntaxes allow mixing
<number>
,<percentage>
and'none'
component values - The
color()
syntax no longer supports omitted component values that default to0
; it now requires exactly three component values. (#186)
Interpretation of component values has been aligned to the spec:
- in non-legacy syntaxes, percentages are mapped to a reference range for that component. For example, the range of
lch.c
(Chroma in the CIELCh color space) is[0, 150]
, with100%
corresponding to150
.
Serialization has also been aligned to the spec:
lab
andlch
serialize theL
component as<number>
, not<percentage>
oklab
,oklch
andlrgb
are serialized tooklab()
,oklch()
, andcolor(srgb-linear)
respectively.
Please consult the migration guide for assistance in upgrading from 2.x to 3.0.
API changes
parseRgb
andparseHsl
now perform parsing of the modern syntax forrgb()
andhsl()
respectively;parseRgbLegacy
andparseHslLegacy
have been added to parse the legacy syntaxes forrgb()
/rgba()
/hsl()
/hsla()
parseOklab
andparseOklch
have been added to parseoklab()
andoklch()
.