- From: Doko Zero via GitHub <sysbot+gh@w3.org>
- Date: Sun, 16 Mar 2025 20:00:16 +0000
- To: public-css-archive@w3.org
dokozero has just created a new issue for https://github.com/w3c/csswg-drafts: == Current state of relative chroma feature in oklch() == I've recently created a [PostCSS plugin](https://github.com/dokozero/postcss-oklch-relative-chroma) to upgrade `oklch()` notation. The goal is to be able to set a chroma value relative to a color space: ```markdown oklch(colorspace L RC H) ``` For example: `oklch(display-p3 80% 100% 20)` which reads as: "for a lightness of 80 % and a hue of 20, I want a color with the maximum chroma possible in the P3 space" and translates to `oklch(80% 0.148 20)`. This would be useful to avoid going out of color space gamut, without the need for a visual color picker, and other use cases. It would also help designers and developers coming from HSL/HSB to use OkLCH in a more familiar way. Indeed, when discovering OkLCH, we might think that for color palettes, a.k.a. lightness variants, we just need to keep fixed absolute chroma and hue values, then simply change the lightness value, but that leads to inconsistent lightness variants. To see the PostCSS plugin in action, get more details, advantages and use cases of this notation, please check the [dedicated documentation repo](https://github.com/dokozero/oklch-css-relative-chroma-documentation). — I've looked at many related issue threads and saw that similar ideas were mentioned. For example: [#8659](https://github.com/w3c/csswg-drafts/issues/8659#issuecomment-1786245149) and [#9449](https://github.com/w3c/csswg-drafts/issues/9449#issuecomment-1944401323). I didn't go for `oklch(L RC of colorspace H)` as I took the same approach from `color(colorspace c1 c2 c3)` for consistency, even if it's true that in the case of `oklch(colorspace L RC H)`, `colorspace` is only for the relative chroma RC value, not the three values. I don't know if it's still being discussed on this repo or elsewhere. I've searched across other issues and didn't find a specific one for this relative chroma upgrade of oklch(), nor a PostCSS plugin that implements it. Hence this issue to know where the idea stands and get feedback on the proposal. --- For background context, I've created the [OkColor Figma plugin](https://www.figma.com/community/plugin/1173638098109123591/okcolor), a color picker to use OkLCH. At the end of 2023, I added relative chroma feature to it, this was motivated from working with OkLCH, often, I wanted to get a lightness variant, but then, I needed to manually change the absolute chroma to avoid going out of gamut. I then realized that simply following the triangle shape in a linear path would do the job, thus adding relative chroma to OkLCH. Then, as I was missing this feature when coding and needed to copy-paste the values from OkColor, I created the [PostCSS plugin](https://github.com/dokozero/postcss-oklch-relative-chroma). Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/11946 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Sunday, 16 March 2025 20:00:17 UTC