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

Okhsl doesn't really scale well past the current targetted space, though Okhsv does handle it a bit better. I guess in its current implementation, you target other RGB spaces (within reason).

For those interested, [here](https://facelessuser.github.io/coloraide/playground/?source=https%3A%2F%2Fgist.githubusercontent.com%2Ffacelessuser%2F01b001178fc742965a011643030357e8%2Fraw%2F5a8993df7d488452761f0853f1538de517c7794e%2Fokwide.py) are implementations of Okhsl and Ohsv for Display P3 and Rec. 2020. Basically, it is just like Okhsl  and Okhsv for sRGB, but you use linear RGB matrices for the targeted RGB gamuts and generate the coefficients using [this](https://colab.research.google.com/drive/1JdXHhEyjjEE--19ZPH1bZV_LiGQBndzs). This doesn't work for all RGB spaces. IIRC it broke down for ProPhoto. I also didn't bother to create one for A98 RGB, but I think it would work. You can view the calculated coefficients by clicking edit in the linked live preview. This is just for educational purposes and not an endorsement for the idea of CSS using such spaces. Personally, I think these spaces do have limitations and are only rough approximations. They sacrifice some of the perceptual qualities of OkLCh to make essentially color pickers for Oklab and OkLCh, but such utility does have value.

<img width="1329" alt="Screenshot 2024-03-21 at 5 23 32 PM" src="https://github.com/w3c/csswg-drafts/assets/1055125/1398ad34-9743-4fc3-876d-2ec6ea8f1be9">



-- 
GitHub Notification of comment by facelessuser
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10110#issuecomment-2014045051 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 23:31:04 UTC