facelessuser / coloraide

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

Maybe make a general ray trace GMA that a user can feed in any LCH space #399

Closed facelessuser closed 8 months ago

facelessuser commented 8 months ago

We just added this on main, but we may disable it. The approach lends itself well to OkLCh and LCh, seems like HCT and CAM16 JMh, but JzCzhz has some issues along with others. I think it is just the relationship to the RGB spaces, we need probably more time to evaluate this more and see if there is a way to ensure any LCh space can be used confidently.

facelessuser commented 8 months ago

I think I found the issue. The ended up removing the final correction and clip because the results were so good in OkLCh and LCh, but this last correction and the final clip cleans up certain regions that manifest must larger in some other LCH spaces.

facelessuser commented 8 months ago

That definitely helped, but it also seems some spaces are more sensitive to negative lightness. JzCzhz can't really deal with it properly.

facelessuser commented 8 months ago

It's just how these spaces have their hue shift in low light and high chroma:

>>> from coloraide.everything import ColorAll as Color
>>> c1 = Color('color(display-p3 1 1 0)')
>>> c2 = Color('color(--lch-d65 0% none none)')
>>> i = Color.interpolate([c1, c2], space='lch-d65', out_space='jzczhz')
>>> i(0.5)
color(jzczhz 0.10135 0.12021 109.19 / 1)
>>> i(0.9)
color(jzczhz 0.02343 0.05266 134.03 / 1)
>>> i(0.98)
color(jzczhz 0.00725 0.03496 154.91 / 1)
>>>

This simply means they don't make for a good GMA space, so nothing more for us to do. We can move ahead and just make a note that not all LCh spaces make good GMA spaces.

facelessuser commented 8 months ago

Yep, it has to do with a disparity between certain perceptual spaces.

When JzCzhz is used as a GMA space, and you are using JzCzhz colors, it does fine:

∆L = 0.0055396209411675 ∆h = -3.8397714873659794 Worst ∆h offender = color(jzczhz 0.1932 0.5 85.5 / 1)

This seems to be a non-issue, just an interesting observation.

facelessuser commented 8 months ago

Closing this as the change has been committed.