irregular sRGB gamut boundary in OKLCH
See original GitHub issueWhen plotting L,C gamut slices I noticed an odd irregularity in the gamut boundary, in OK LCH. I didn’t see the same irregularity in CIE LCH. The code is
let swatch = new Color("oklch", [lightness, chroma, hue]);
let rgb = swatch.to("sRGB");
// console.log({swatch, rgb});
if (rgb.inGamut("srgb")) {
fill = rgb.toString(); // .to("srgb");
}
I suspect this is due to the inGamut() call, rather than being an irregularity in OKLab/ OK LCH itself.
Issue Analytics
- State:
- Created 2 years ago
- Comments:12 (1 by maintainers)
Top Results From Across the Web
Better than Lab? Gamut reduction CIE Lab & OKLab - W3C
Snap (clip) to closest gamut boundary if imperceptible. intersecting gamut boundary. Display P3 yellow to sRGB: Strict gamut intersection. Out of P3 gamut...
Read more >[css-color-4] Gamut Mapping with Oklch - Odd Results #7071
The first set of examples is gamut mapping the interpolated colors into sRGB with Oklch chroma reduction. Notice how poor the results are ......
Read more >Two new color spaces for color picking - Okhsv and Okhsl
The main drawback of using these models directly for color picking is that the sRGB gamut has a quite irregular shape in these...
Read more >More experiments with sRGB gamut boundary in L*a*b* space
I'm still playing around with RGB gamut calculations in $ L^* a^* b^* $ space. (See my last post on this topic, "Visualizing...
Read more >Accurate gamut boundary descriptor for displays
Abstract: A new gamut boundary descriptor (GBD) is presented in this paper. ... standards, such as the traditional sRGB standard [1], ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yeah, it seems confined to a very small hue range and a small band within that very small hue range, so probably maybe not a huge deal, but yeah, not ideal either though.
I’ve personally constrained my color library to use LCh by default (for now), only because its weaknesses are well known in relation to gamut mapping. OkLCh is kind of new in this area, and I don’t think it has been stressed enough to know where all its weaknesses are. I know I created another issue over at the CSSWG related to some unexpected behavior with OkLCh and gamut mapping: https://github.com/w3c/csswg-drafts/issues/7071. This also may not be a huge deal in most cases, but I did find it unexpected.
With that said, I think Oklab works pretty well for color interpolation at least 🙂.
Yep, it’s definitely not a big deal. I tried it with
oklch(30.57% 0.22 264.09)
. The binary search chroma reduction algorithm jumps over#000296
and stops at#001788
. So it reduces chroma to 0.18 instead of 0.21. The difference is so subtle I can hardly see it 😅