Releases: facelessuser/coloraide
0.14.2
0.14.2
- FIX: Fix rare issue where precision adjustment could fail.
- FIX: Fix
util.divide
logic when dividing a number or vector by a matrix. There are no actual usage of these
cases in the code but fixed in case they are used in the future. - FIX: Minor performance improvements.
0.14.1
0.14.1
- FIX: Fix bug related to parsing strings without full matching.
0.14.0
0.14.0
Note
No changes should break existing color space plugins. Moved objects and references are still also available in old
locations, and new functionality is implemented in such a way as to not break existing plugins, but plugins should
be updated as sometime before the 1.0 release, such legacy access will be removed.
- NEW: Faster parsing. Instead of parsing the
color(space ...)
format each a different color space is evaluated,
generically parse it once and then associate it with a registered color space. If a color space wishes to opt out of
thecolor(space ...)
input format, the space should setCOLOR_FORMAT
toFalse
. This means there is no need to
callsuper.match()
when overridingColor.match()
to ensure support for thecolor(space ...)
format as it will be
handled unlessCOLOR_FORMAT
is turned off.DEFAULT_MATCH
usage should also be discontinued as it now does nothing. - NEW: Other speed optimizations.
- NEW: All CSS parsing and serialization is now contained in a single module at
coloraide.css
. This simplifies
the current color space classes greatly when it comes to supporting CSS specific formats. - NEW: Move our white space mapping to the
cat
module as it makes more sense there. - NEW:
GamutBound
,GamutUnbound
, and associated flags are now contained undercoloraide.gamut.bounds
. - NEW:
normalize
will also remove masked values to properly adjust the color. - FIX: Compositing and blending should not "fit" colors before applying, it is only specified that the range should
be clamped at the end of blending. - FIX: Fix issue where a subclassed
Color()
object could not recognize the base class or other subclasses.
0.13.0
0.13.0
- NEW: Add new
closest
method that takes a list of colors and returns the one that is closet to the calling color
object. - NEW: CSS color syntax no longer allows for forgiving channels in
color()
. This means that when a channel other
than alpha is omitted, we will no longer treat them as undefined. Instead, the color will simply fail to parse.
Raw data channels also must specify all channels. - NEW: Clamp lower bounds of chroma at the channel level.
- NEW:
coloraide.spaces.WHITES
is now a 2 deep dictionary containing both 2˚ and 10˚ observer variants of white
points. - NEW: Color space plugins now specify
WHITE
as a tuple with the x and y chromaticity coordinates. This allows a
space to specify unknown white points if desired. - FIX: Fix
longer
hue interpolation whenθ1 - θ2 = 0
. The spec is wrong in this case, and interpolation should
still occur the long way around instead of keeping hue constant. - FIX: Reduce redundancy in some CSS parsing patterns.
- FIX: Minor performance improvements.
- FIX: Legacy
rgb()
,rgba()
,hsl()
, andhsla()
comma separated forms in CSS do not supportnone
, only the
new space separated forms do. - FIX: Ensure
py.typed
is installed with package so that type annotations work properly.
0.12.0
0.12.0
- NEW: Add a gamut mapping variant that matches the CSS Color Level 4 spec.
- FIX: Fix precision rounding issue.
0.11.0
0.11.0
Warning: Breaking Changes
Prior to 0.11.0, if you specified a cylindrical space directly, ColorAide would normalize undefined hues the same
way that the conversion algorithm did. In the below case, saturation is zero, so the hue was declared undefined.>>> Color('hsl(270 0% 50%)') color(--hsl none 0 0.5 / 1)We should not have been doing this, and it made some cases of interpolation a bit confusing. It is no longer
done as the hues are in fact specified by the user, even if they are powerless in relation to contributing to
the rendered color. When a cylindrical color is converted or if a user declares the channel as undefined with
none
or some other way, then the channel will be declared undefined, because in these cases, they truly are.>>> Color('white').convert('hsl') color(--hsl none 0 1 / 1) >>> Color('color(--hsl none 0 0.5)') color(--hsl none 0 0.5)If you are working directly in a cylindrical color space and ever wish to force the normalization of color hues
as undefined when the color meets the usual requirements as specified by the color space's current rules, just
callnormalize
on the color and it will apply the same logic that occurs during the conversion process.>>> Color('hsl(270 0% 50%)').normalize() color(--hsl none 0 0.5 / 1)If you relied on commas in CSS forms that did not support them, this behavior is no longer allowed. It was
thought that CSS may consider allowing comma formats in formats likehwb()
, etc., and it was considered, but
ultimately the decision was to avoid adding such support. We've updated our input and output support to reflect
this. Color spaces can always be subclassed and have this support added back, if desired, but will not be shipped
as the default anymore.The D65 form of Luv and LCHuv is now the only supported Luv based color spaces by default now. D50 Luv and LCHuv
have been dropped andluv
andlchuv
now refers to the D65 version. In most places, the D65 is the most common
used white space as most monitors are calibrated for this white point. The only reason CIELAB and CIELCH are D50
by default is that CSS requires it. Anyone interested in using Luv with a different white point can easily
subclass the current Luv and create a new plugin color space that uses the new white point.Renamed DIN99o Lch identifier to the short name of
lch99o
.>
- NEW: ColorAide now only ships with the D65 version Luv and LCHuv as D65, in most places is the expected white
space. Now, the identifierluv
andlchuv
will refer to the D65 version of the respective color spaces. D50
variants are no longer available by default. - NEW: Add the HSLuv color space.
- NEW: DIN99o Lch identifier was renamed from
din99o-lch
tolch99o
. To use in CSScolor()
form, use
--lch99o
. - NEW: Refactor chroma reduction/MINDE logic to cut processing time in half. Gamut mapping results remain very
similar. - NEW: Be more strict with CSS inputs and outputs.
hwb()
,lab()
,lch()
,oklab()
, andoklch()
no longer
support comma string formats. - NEW: Officially drop Python 3.6 support.
- FIX: Do not assume user defined, powerless hues as undefined. If they are defined by the user, they should be
respected, even if they have no effect on the current color. This helps to ensure interpolations acts in an
unsurprising way. If a user manually specifies the channel withnone
, then it will be considered undefined, or if
the color goes through a conversion to a space that cannot pick an appropriate hue, they will also be undefined.
0.10.0
0.10.0
- NEW: Switch back to using CIELCH for gamut mapping (
lch-chroma
). There are still some edge cases that make
oklch-chroma
less desirable. - FIX: Fix an issue where when attempting to generate steps some ∆E distance apart, the maximum step range was not
respected and could result in large hangs.
0.9.0
0.9.0
Warning: Breaking Change
Custom gamut mapping plugins no longer return coordinates and require the method to update the passed in color.
- NEW: Improved, faster gamut mapping algorithm.
- NEW: FIT plugins (gamut mapping) no longer return coordinates but should modify the color passed in.
- NEW: Expose default interpolation space as a class variable that can be controlled when creating a custom class
via class inheritance. - NEW: Colors can now directly specify the ∆E method that is used when interpolating color steps and using
max_delta_e
via the newdelta_e
argument. If thedelta_e
parameter is omitted, the color object's default ∆E
method will be used. - NEW: Oklab is now the default interpolation color space.
- NEW: Interpolation will now avoid fitting colors that are out of gamut unless the color space cannot represent
out of gamut colors. Currently, all of the RGB colors (srgb
,display-p3
, etc.) all support extended ranges, but
the HSL, HWB, and HSV color models forsrgb
(including spaces such asokhsl
andokhsv
) do not support extended
ranges and will still be gamut mapped. - FIX: Remove some incorrect code from the gamut mapping algorithm that would shortcut the mapping to reduce chroma
to zero.
0.8.0
0.8.0
Warning: Breaking Change
The use of
xyz
as the color space name has been changed in favor ofxyz-d65
. This better matches the CSS
specification. As we are still in a prerelease state, we have not provided any backwards compatibility.CSS color input strings in the form
#!css-color color(xyz x y z)
will continue to be accepted as CSS will allow
both thexyz
and thexyz-d65
identifier, but output serialization will prefer the
#!css-color color(xyz-d65 x y z)
form as usingxyz
is an alias forxyz-d65
.Again, this breaking change only affects operations where the color space "name" is used in the API to specify usage
of a specific color space in order to create a color, convert, mutate, interpolate, etc.Color('red').convert('xyz') # Bad Color('red').convert('xyz-d65') # Okay Color('xyz' [0, 0, 0]) # Bad Color('xyz-d65' [0, 0, 0]) # Okay Color('red').interpolate('green', space='xyz') # Bad Color('red').interpolate('green', space='xyz-d65') # Okay # No changes to CSS inputs Color('color(xyz 0 0 0)') # Okay Color('color(xyz-d65 0 0 0)') # Okay
- NEW: Custom fit plugin's
fit
method now allows additionalkwargs
in its signature. The API will accept
kwargs
allowing a custom fit plugin to have configurable parameters. None of the current built-in plugins provide
additional parameters, but this is provided in case it is found useful in the future. - NEW: XYZ D65 space will now be known as
xyz-d65
, notxyz
. Per the CSS specification, we also ensure XYZ D65
color space serializes asxyz-d65
instead of the aliasxyz
. CSS input string format will still accept thexyz
identifier as this is defined in the CSS specification as an alias forxyz-d65
, but when serializing a color to a
string, thexyz-d65
will be used as the preferred form. - NEW: By default, gamut mapping is done with
oklch-chroma
which matches the current CSS specification. If
desired, the old way (lch-chroma
) can manually be specified or set as the default by subclassingColor
and setting
FIT
tolch-chroma
. - FIX: Ensure the
convert
method'sfit
parameter is typed appropriately and is documented correctly.
0.7.0
0.7.0
- NEW: Formally expose
srgb-linear
as a valid color space. - NEW: Distance plugins and gamut mapping plugins now use
classmethod
instead ofstaticmethod
. This allows for
inheritance from other classes and the overriding of plugin options included as class members. - NEW: Tweak Lch chroma gamut mapping threshold.
- FIX: Issue where it is possible, when generating steps, to cause a shift in midpoint of colors if exceeding the
maximum steps. Ensure that no stops are injected if injecting a stop between every color would exceed the max steps.