[csswg-drafts] [css-color] a new property to limit to a specific color gamut (#10038)

romainmenke has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-color] a new property to limit to a specific color gamut ==
see : https://github.com/w3c/csswg-drafts/issues/9449#issuecomment-1980976323

@ccameron-chromium said :

>If an author specifies content that is far outside of what their screen can reproduce, then there is no way to avoid having them be surprised when that content is accurately rendered on a more capable screen.
>
>This is very much a "the only winning move is not to play" situation. We shouldn't be giving authors tools where it is extremely easy to unintentionally specify such colors. But we did, in the lab, lch, oklab, and oklch spaces. The oklab and oklch spaces are excellent for perceptually uniform interpolation, but they are dangerous for color manipulation, because there are no guardrails for staying in-gamut. The [relative-color syntax](https://www.w3.org/TR/css-color-5/#example-fef81186) exacerbates this.
>
>The problem that I want for us to focus on solving here is how to avoid having authors specify colors that are far beyond their display's capability to produce.
>
>If we don't solve that problem then authors will inevitably face the above-described surprise.
>
>If we don't solve that problem then we also have to solve the problem of assigning meaning to colors that are physically meaningless or far beyond the capabilities of any current display.

------

_This comment was made in the context of gamut mapping for colors when those colors go beyond the device capability._

_While I don't agree with that line of thinking, I do think there is something here and I want to explore it from a different perspective._

------

There is a disconnect between:
- what authors describe
- what they can observe today
- what their intention was
- how values will be displayed in x years on vastly superior hardware.

Authors can easily write CSS that produces color values that are outside specific color gamuts.
With interpolation, animations, relative color, ... this can often happen without the author noticing at the time of writing that specific code.

Should it be possible for authors to force a document to gamut map all colors to a specific gamut?

Maybe through a new property :

```
:root {
  max-color-gamut: display-p3;
}
```

Authors would then be able to use things like interpolation in `lch` without having to worry about unexpected outcomes on future hardware.

It gives you access to the color models behind `oklch`, `lch`, ... without having to think about extremely out of gamut results.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10038 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 6 March 2024 15:48:27 UTC