facelessuser / coloraide

A library to aid in using colors
https://facelessuser.github.io/coloraide
MIT License
195 stars 12 forks source link

CSS Powerless interpolation #294

Closed facelessuser closed 1 year ago

facelessuser commented 1 year ago

We should consider the possibility of adding the CSS approach to powerless channels when interpolating. In general, the concept is pretty straightforward. When interpolating, if lightness creates a white or black color, chroma/saturation becomes powerless during the interpolation. It's kind of like how hue is generally powerless and gets undefined when chroma/saturation is 0 (or near zero). This would apply to Lab colors as well with lightness causing a and b to become powerless. The big issue is with colors like CAM16 JMh and HCT. Neither of which have easy to predict achromatic responses and could cause complications in how things get sanely calculated for them.

facelessuser commented 1 year ago

I'm not entirely sure how we should go about dealing with HDR colors using this system. In JzAzBz, do we pick the arbitrary 0.26607 to be the limit for white? Do we let it to go the HDR white? There's a lot of uncertainty.

facelessuser commented 1 year ago

I've decided this is a terrible idea. The current CSS spec, if it truly intended for chroma to be treated as powerless (powerless meaning undefined) during interpolation when the lightness is 0% or 100%, they are misguided.

Screenshot 2023-03-29 at 11 26 55 AM Screenshot 2023-03-29 at 11 30 57 AM

I will not introduce a change like this that will actually break good interpolation.

facelessuser commented 1 year ago

It may be that powerless, in the case of chroma and Lab-like a/b values mean to imply they are floored to zero. If this was the case, it would be somewhat more reasonable. For some color spaces, this would not be ideal, but at least the results would be more sensible. Regardless, unless strong reasons are raised to add such behavior, we probably won't be adding such logic, forcing a neutral chroma and hue for black and white. Users should just be aware if they ramp up such values, it could cause issues.