Re: [csswg-drafts] [css-color] Add OKLab, OKLCH (#6642)

Objectively, as someone that supports Oklab in a library outside of CSS, I can generally say these matrices seem to give values that you would expect while giving a better response for chroma and pretty much eliminating the effect of hue on achromatic colors.

---

**This has nothing to do with CSS**

With that said, and this would not specifically be a problem for CSS, I also support Okhsl and Okhsv. Using both the `XYZtoLMS` and `LMStoOKLab` matrix seems to have a noticeable impact on those two color spaces. I've tried using the workbook provided by Björn in his blog, updating the values to give better Okhsl and Okhsv support with these matrices, but there seems to be some tuning in the translation algorithm's not quite explained. Blue was pushed further out of the gamut, and then the algorithm would generate values too large for the language I was in and cause an overflow (probably due to the high precision of the values).

What I did find was that by simply using the more accurate `LMStoOKLab` matrix, I was able to get the same great response driving chroma to zero without causing a disparity between Oklab and Okhsl/Okhsv. I did not increase the precision of matrix calculations in Okhsl/Okhsv. Round trip was excellent between all these spaces.

I am most interested in  getting the float 64 representation of this matrix.

```
[
    [0.77849780, 0.34399940, -0.12249720],
    [0.03303601, 0.93076195, 0.03620204],
    [0.05092917, 0.27933344, 0.66973739]
]
```

I wonder if the fact that I use a non-rational XYZtoRGB matrix everywhere else and that the calculation as you suggested used a rational number calculated XYZtoRGB matrix causes some disparity. Or if the Okhsl and Okhsv algorithm just isn't tuned well for these high-precision matrices and a slight shift to the response.

Regardless, using the high-precision LMStoOKLab matrix is more than sufficient to fix achromatic issues and provide good translations.


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


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

Received on Friday, 31 March 2023 13:23:27 UTC