-
Notifications
You must be signed in to change notification settings - Fork 9
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
Out of gammut colors on Color.{to,of}_lch_uv round trips #8
Comments
This is not really surprising as the gamut of linear This was written a long time ago but I think the reasoning behind this behaviour was that the client is in a better position to know what it wants to do with out of gamut colors. In your case it seems you simply want to use I should however update the docs to make it clear that this can happen. (/cc @edwintorok who authored the color conversion functions) |
Handling of out of gamut colors should be documented I agree, but the initial example is not out of gamut: there is just loss of precision due to floating point multiplication/division and in a roundtrip you don't get back exactly the value you started out with. |
Sure but hacks for nicing floating point inaccuracies tend to lead to slippery slopes. It's seems however that the code is already doing a bit of epsilon testing. So yeah maybe we could try to see if there's an uniform way of making sure results round trip on sRGB boundaries. |
FWIW the code in |
Thanks for the answers, Still, I made an experiment, displaying all colors at lightness 70, with and without clamp. Can you confirm the result is as expected? |
I added a warning to the docs. It would still be nice to see if we can do something about round trips. |
Colors with negative components are not rendered as far as I tested.
It seems to be quite easy to get invalid colors, here is another example with a larger negative component.
I even got some components bigger than 1. on some examples.
The text was updated successfully, but these errors were encountered: