-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CSS gamut mapping method gives incorrect results #408
Comments
I think this is just a result of the weird shape of the OKLCH color space for imaginary colors in the blueish hue range. I had assumed that converting |
I see you are using ColorAide as an example. Keep in mind a couple of things: You didn't specify a gamut, so no gamut mapping occurred when you used If the color is quite extreme in the bluish region, OkLCh kind of breaks down once you are out of the visible gamut. It's one of the reasons I still default to LCh gamut mapping even if OkLCh does better in many instances. LCh doesn't handle certain regions perfectly (purple shift in blue region), but the shape of LCh in extreme gamuts gives more sane results generally. I think it ends up being less surprising generally. I still think OkLCh does better when the colors are not so extreme, I just think you have to use it in situations where OKLCh doesn't break down. I've posted this before, but we can see this when OkLCh is rendered in the ProPhoto gamut. To illustrate why the algorithm fails, let's try visualizing it by gamut mapping Some Lab color spaces, while not having a defined gamut, can still have reasonable limits. Even spaces like CAM16 can break down if they are rendered in a large enough gamut. Notice blue twisting back into the color solid. |
Thanks for the explanation. I think I may end up gamut mapping using LCh for the color spaces where the results look really broken. At any rate this isn't an issue so I'm gonna close it. |
That makes sense. If you are using ColorAide as a comparison, it might not always match what Color.js generates as I use LCh with a D65 white point for gamut mapping and Color.js uses D50. Just an FYI. |
Example color is
lch(40.383 143.28 272.5)
which should have a blueish hue.CSS Gamut mapping
https://colorjs.io/apps/convert/?color=lch(40.383%20143.28%20272.5)&precision=4
Gamut mapping using lch.c
Coloraide gamut mapping using 'oklch-chroma'
The text was updated successfully, but these errors were encountered: