Sharing Tonal-OKLCh, a hybrid OKLCh + CIE L* color space. Curious about your thoughts #516
Replies: 1 comment 1 reply
-
Yep, I had thought about this approach before, but I just never followed through with it. My experiments were mainly focused on whether you could get similar results to HCT without gluing CIE LCh directly to OkLCh and having to perform a more expensive estimation to get back out of it. Not that there is anything wrong with such an approach, but it is more expensive. Essentially, I think my experiments showed that the idea of using a toe function may be a viable way to get decent tonal maps, though I have yet to explore it beyond my initial experiments. Also, keep in mind, my experiments did not push it so far as to find the perfect, optimal coefficients for the best lightness, only something good enough to get something with similar-ish results to HCT. I'm certain the values could be tuned even more. Regardless, I make no claims that my approach is superior, only that I found it interesting to explore and that it could be a computationally inexpensive way to get something OK enough to use 🙂. With all of that said, I think having an OkLCh with exact (or close to exact) parity with LCh lightness does produce better results for tonal maps than using standard OkLCh lightness.
I'm not sure. As I noted earlier, I didn't really optimize for contrast on my end or anything. It was a rough experiment to get something visually close, but no optimization deeper than that was explored. I figured if I had a direct need, I could explore it more in the future. I'm sure it could be tuned even more. In short, I think your idea of a merged OkLCh and LCH lightness is a fine idea. I think it would be cool if estimating back out of such a space had a clever, faster way to translate out of it other than bisection, but that may just be the way it is without using some kind of LUT or something. I don't know if I actually answered what you were looking for 😅, but it's cool seeing this idea implemented. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi Isaac,
Long-time admirer of ColorAide. Your "Exploring Tonal Palettes" gist came up as an adjacent approach when I was validating a hybrid color space I created, so I wanted to share it back and get your thoughts.
The color space is called Tonal-OKLCh (GitHub). It takes the same approach as HCT by keeping CIE L* as the lightness axis but pairing it with OKLCh's hue and chroma.
The motivation to create this color space was that I'm a design systems designer and often need to create multi color themes with consistent contrast against the same background regardless of hue. HCT did a good job, but it still has the blue → purple hue shift issue, so I wanted to try the same approach with OKLCh in place of CAM16.
The method was given a target tone, hue, and chroma, it binary-searches OKLCh's L to find the L that produces the target CIE Y. If chroma is out of sRGB gamut, a second search reduces chroma, resolving L at every step so luminance never drifts during gamut mapping. A final post-quantization nudge (±1 per RGB channel, picking the closest to target Y) tightens contrast spread to ~0.02 after 8-bit hex rounding. Achromatic colors skip the nudge to preserve R=G=B.
As part of due diligence, I evaluated adjacent approaches, including OKLrCh and your tweaked toe constants from the gist. They're perceptually great, but for the use case I needed (consistent contrast across hues), they still showed measurable contrast spread at the same Lr. The comparison is on the About page under "Alternatives." Code here if you'd like to check the method. I think this lines up with nealmckee's note about a ~0.5 L shear in the red/green axis - small perceptually, but enough to nudge contrast ratios.
Does the contrast variation I'm seeing with the toe function match what you'd expect, or is my implementation missing something? And any concerns or suggestions on the Tonal-OKLCh implementation itself, I'd value the feedback.
Thanks again for ColorAide and the gist,
Ethan
Beta Was this translation helpful? Give feedback.
All reactions