Re: [csswg-drafts] [css-color-4] Are a and b in lab( 0%, a, b ) really powerless? [css-color-4] (#6758)

@dd8 wrote:

> lab( 0%, -100, 100 ) = oklch(-17.24% 0.29655 146.962)

OK let's pick that one apart to see what is happening. the a,b values put it off in the corner of the a,b plane so it is a highly saturated color, and L is 0 so this is the same lightness as black. _(This color is not physically realizable, and is also outside the spectral locus) so we can't see it, either._ But we can reason about it.

First lets set the [lightness to 50%](https://colorjs.io/apps/convert/?color=lab(50%25%2C%20-100%2C%20100%20)&precision=4) so we can see what color it is. OK it is a very saturated green, outside the gamut of sRGB,and display-p3, and even Rec.2020 and ProPhoto-RGB. In OKLCH it is `oklch(53.87% 0.315 148.4)` so lets see if that hue angle is preserved.

Now change the [Lightness to 1%](https://colorjs.io/apps/convert/?color=lab(1%25%2C%20-100%2C%20100%20)&precision=4) and see what we get.

Remembering that Lab is adapted to a D50 whitepoint while most RGB spaces use D65, lets see the D65 value:

`lab(1%, -100, 100)` = `lab-d65(0.628% -109 100.6)`

Notice that as a consequence of chromatic adaptation, a and b no longer have equal values, the ab plane has tilted. And because this color is off in the corner, that tilt has reduced the Lightness as well.

Now the same for [`lab(0%, -100, 100)`](https://colorjs.io/apps/convert/?color=lab(0%25%2C%20-100%2C%20100%20)&precision=4) = `lab-d65(-0.37% -109 100.6)`

The tilt has actually made the Lightness negative. And, given that OKLab is also D65, we can see why we get a negative Lightness there, too. `oklch(-17.2% 0.297 147)` and the hue angle is very close to what we got before so seems legit.

(Remember that OKLab exposes some deviations from perceptual uniformity in CIE Lab, particularly for highly-saturated colors).

-- 
GitHub Notification of comment by svgeesus
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6758#issuecomment-1246920697 using your GitHub account


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

Received on Wednesday, 14 September 2022 15:14:25 UTC