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
Add Oklab and Oklch #674
Add Oklab and Oklch #674
Conversation
Reviewers, there are subfeatures in https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/oklab#browser_compatibility worth considering. I think we should treat "Mix I think "Relative Oklab colors" should be in a @romainmenke do you have thoughts on how all the new color goodness should be structured, in terms of groups and features? |
My current view on the evolution of the color type [css-color-3] had fewer ways to define colors and the syntax was a bit different
[css-color-4] introduced a modern syntax, but this was spread out over many years.
https://drafts.csswg.org/css-color-4/#color-syntax-modern
Not really a bug, more part of the general syntax refresh in [css-color-4]
[css-color-4] also introduced a lot of new color functions, the ability to define wider gamut colors and new system colors. [css-color-5] is more focussed on creating colors from existing colors
I think it might make sense to have a group for Back to this PR : I think that grouping by color space ( Maybe a group with all the new color functions also makes sense? |
I made an unfortunate discovery yesterday that there's an interoperability issue with Oklab and Oklch for lightness 0% and 100% when chroma is non-zero and (as a consequence) it's outside of any RGB color space: When the dust has settled on how a lightness gradient like this should behave, I think notes will be warranted for this feature, perhaps even "partial implementation" if we had that. Right now we have neither, but I'll put a comment in the file for future us to fix. |
Thank you @romainmenke, that timeline view is helpful. I agree that a colors group would make sense when we have that. I'm glad you agree that |
Might be good to make a choice here if gamut mapping (or an alternative solution to the same issue) is a sub feature or a critical part of the implementation. I think that authors can use all the new color functions today even without gamut mapping. On the other hand the same input will produce a different output after the eventual solution is shipped. So that would mean the current situation is a partial/buggy implementation. |
If we surface this as a feature or as a note, I think we should try to describe it in as simple terms as possible. I would say the "feature" is "always goes from black to white somewhat smoothly", which no browser currently does.
Yeah, since browsers now disagree about what color |
"gamut mapping" is the simplest term to describe the feature, even if that is a new term for developers. I am concerned that any alternative description would be incorrect in various ways.
This only covers a tiny fraction of the problem space that gamut mapping addresses. |
Perhaps that is the right name for it, if the description can make it clear what it is and what to look out for. If describing what has already shipped in browsers, there are only two things:
Given that reality, what advice should notes give if any, if we could add notes. Is it "be very sure to stay inside of P3 or the color you see may change in the future?" |
If authors want somewhat stable results they can only use static values that are known to fit within They can't use Gamut mapping (as specified) is just a critical part of everything in css-color-4 and css-color-5. Most of the features do not work correctly without it. It is not a layer on top, it is the foundation. Authors should look out for:
I think it is very tricky to think of clipping and the single hacks for Communicating exactly what gamut mapping is in CSS and how values were initially incorrect, is just very hard when there is no consensus :/ The simpler path forward is to not do anything in particular in web-features. |
This seems like the right path to me as well. We don't even have notes right now, so there's nothing I could do in this PR. |
Since this is messy and I don't really understand color spaces, I've got some questions:
As a know-nothing, I suspect something is going on here along these lines: there's a feature (Oklab and Oklch) that is kinda not great for developers, but is interoperable. In the future there might be some follow-up feature ("Gamut mapping for Oklab and Oklch"), which will make it better. But right now no such thing exists so we can't meaningfully say that browsers are missing anything at all. That said, when that new feature does appear and we hear from developers that the gamut-mapping bit is an essential part of "Oklab and Oklch support" ( |
While it's possible to debate what the spec really requires, the important point is that the spec editors were very clear in their intentions around gamut mapping (that it's non-optional and important to get other features like relative color syntax to work well) but implementers disagreed about the tradeoff and shipped with channel clipping. It's not an oversight or a problem of interpretation, but a disagreement about what's acceptable to ship and not.
I think we should add notes pointing to the browser bugs for gamut mapping. I don't think it should be
I thought so too, but https://crbug.com/329106317. I'm adding tests for it in web-platform-tests/wpt#45073. The interop issue isn't gamut mapping generally, but the special handling of lightness 0 and 1. What developers need to know is that increasing lightness will eventually clamp to white in Chrome, but not in Firefox/Safari. We should be careful to not describe either as a bug, because neither behavior is actually good. |
I've now also sent #684 for CIE Lab. |
Thank you @foolip. That's very clarifying.
Understood. Is this something we can capture in BCD, today? A behavioral subfeature, like "Black and white clamping"? If we said it was non-standard, it'd be (rightly) recognized as not-great without implying bugginess. Also, I think I'd be happy with this merging, given the explanations above. 👍 |
I've filed mdn/browser-compat-data#22646 to get this noted in BCD. |
No description provided.