-
Notifications
You must be signed in to change notification settings - Fork 65
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
If I paste RGB color, resulting oklch has too much precision and doesn’t fit into textbox #158
Comments
We do it for a reason. For instance, So we check does the precision reduction change the gamut and if to change it, we do not round the numbers. Here is the code oklch-picker/stores/current.ts Lines 189 to 194 in 36cd239
Any idea how we can improve the algorithm? |
Yes. Round the numbers. If it goes into P3 territory and display can’t show it, it will be rounded down anyway |
Browser will use P3 > sRGB gamut correction which will change the color a little. As the result you will have a small color shift after hex > OKLCH convert. |
Is that bad? E.g. if I paste |
Here we will have double shift. The second problem is that browser's P3 > sRGB gamut correction could be different leading to a different shift. |
Another problem is that it is confuse users. They put obviously sRGB color, but tool tell them that it is P3 color. We added this feature because people asked us in another issue. |
One idea could be, instead of rounding being all-or-nothing ("if the rounded value is a mismatch then don't round at all"), instead round incrementally. |
I like the idea. Can you send PR? |
hey @ai , would like to work on this. Let me know if this issue is still open. Thanks. |
@ankiiisharma yes, we still need help here to implement @SomeNameDee algorithm |
Steps to reproduce:
0067E2
into RGBExpected:
oklch(54% 0.20 258)
Actual:
oklch(54.12% 0.203760003850602 258.38835815691493)
The text was updated successfully, but these errors were encountered: