You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If one of the colors has a NaN hue and lb == 0 (pure black), the saturation is taken as-is from the other color.
This means that interpolate('#f00', '#000', 1, 'hcl') results in hcl(40, 104, 0) instead of hcl(40, 0, 0).
Version 2.4.2
The text was updated successfully, but these errors were encountered:
@bkahlert Thanks for the suggestion!
We use chroma.js to handle colors in Motion Canvas and this problem was reported by one of our users.
I told them to use a different color space but it would be great to have it fixed here.
Description
When using the hcl/lch color space for interpolating between saturated colors and black, the resulting value is not correct:
The problem occurs only if one of the colors is pure black. Increasing the brightness even sliglty results in a correct color:
Similarly, if the other color has no saturation, the interpolation is also correct:
Possible explanation
It seems that this may be caused by the interpolator used for hcl/lch:
chroma.js/src/interpolator/_hsx.js
Lines 44 to 49 in cd1b3c0
If one of the colors has a
NaN
hue andlb == 0
(pure black), the saturation is taken as-is from the other color.This means that
interpolate('#f00', '#000', 1, 'hcl')
results inhcl(40, 104, 0)
instead ofhcl(40, 0, 0)
.Version
2.4.2
The text was updated successfully, but these errors were encountered: