[csswg-drafts] [css-color-4] Need a future-proof way to adjust lightness of a color (#10110)

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

== [css-color-4] Need a future-proof way to adjust lightness of a color ==
The current relative color syntax offers the promise of being able to adjust properties such as the lightness of a color. When increasing lightness of a color in the `oklch` color space, one very quickly goes far out of the gamut of current displays. This creates a problem wherein the content author is not seeing the color that they specified. In the future, that content will be within the capabilities of display hardware, and the result will not be what the author saw when they created the page (by definition).

The request in this issue is to create a mechanism wherein authors can avoid this problem.

Here is a worked example. Suppose I like the color `color(srgb 1 0.09 0.54)`.

I may be tempted to create a lighter version of this color by doing:
```
    oklch(from color(srgb 1 0.09 0.54) 90% c h)
```
The original color, in oklch, is:
```
    oklch(65.28% 0.2572 0)
```
And so the resulting color is:
```
    oklch(90% 0.2572 0)
```
This color is equivalent to:
```
    color(srgb 1.37 0.516 0.843)
```
This color is currently outside of the gamut of almost all displays.

On an sRGB display, CSS gamut mapping would display it as:
```
    color(srgb 1 0.785 0.862)
```

This is not close to the true meaning of the color. By playing some games with the settings of one’s monitor, some displays are capable of producing the true color. On Chrome, because of some quirky implementation details (which are likely to change), you can see the true color (for a slightly different example value) [here](https://ccameron-chromium.github.io/webgl-examples/oklab.html) on some displays. The following is a photo of the true color (which doesn’t quite do it justice):
![photo](https://github.com/w3c/csswg-drafts/assets/32557109/26a40da2-a55c-470c-860f-d982bd58c0b1)



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


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

Received on Thursday, 21 March 2024 10:54:55 UTC