- From: Isaac Muse via GitHub <sysbot+gh@w3.org>
- Date: Wed, 02 Oct 2024 23:51:06 +0000
- To: public-css-archive@w3.org
There's no specific insight into exactly what was done with the James'. There was a claim to have a 64 bit version of the initial matrix of ``` [ [0.77849780, 0.34399940, -0.12249720], [0.03303601, 0.93076195, 0.03620204], [0.05092917, 0.27933344, 0.66973739] ] ``` But it was never posted. My personal interest was to see the approach and verify it. I had noticed an issue using Jame's matrices when applied to Okhsl as well, so I was hesitant to use them without being able to see the process and understand it more. I won't speculate as to exactly what the issue is, only that I had no further insight without being able to evaluate what was actually done. This, of course, does not specifically affect CSS as it does not currently use Okhsl, but it was a concern for me. I make no claims on the correctness or incorrectness of what James provided. It is likely that there is absolutely nothing wrong with the approach and that Okhsl simply did not handle the 64 bit version of the XYZ_to_LMS portion of the algorithm. --- With that out of the way, I can give details as to what is done in Color.js and provide a reproducible example of how it was generated. The problem with the Oklab matrices as previously defined is that they simply do not resolve `oklab(1 0 0)` to LMS `[1, 1, 1]` in 64 bit. This is due to how the 32 bit matrices are applied in a 64 bit data type environment, which Color.js uses. Because of this, as lightness increases, achromatic values for `a` and `b` deviate further from zero. When trying to apply CSS logic for powerless values, a larger and larger threshold would need to be used as lightness increases. CSS simply took the LMS_to_Oklab matrix (the forward transform) and generated the 64 bit inverse matrix for the reverse transform. The problem is that the forward transform does not give you `oklab(1 0 0)` == LMS `[1, 1, 1]` in a 64 bit environment. It turns out the 32 bit inverse matrix does support `oklab(1 0 0)` == LMS `[1, 1, 1]`, so if you use reverse transform to generate the forward transform for LMS_to_Oklab, you resolve the disparity for achromatic values. You can further emit the reverse transform as 64 bit before inverting the matrix which cleaned up the results a bit more. That is all that was needed and all that was done. These matrices also did not cause adverse effects when used in Okhsl. You can recreate them yourself with this script: https://github.com/color-js/color.js/blob/main/scripts/oklab_matrix_maker.py. This makes the changes transparent. -- GitHub Notification of comment by facelessuser Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6642#issuecomment-2389992950 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Wednesday, 2 October 2024 23:51:08 UTC