Re: [csswg-drafts] Allow specifying color space for lch() and hsl()? (allow specifying colors in formats other than RGB, with color spaces other than SRGB) (#9732)

> Right now it looks like the only way to specify colors outside the SRGB colorspace is using the color() function, which takes values for the amount of R G B and A, like the rgb() function, and there is no other way to do so.

Incorrect; 

> It would be very useful if I could use functions like `hsl()` or `lch()`, that allow me to define hue sat and lum instead of RGB

Right, it is much easier to manipulate perceptually distinct axes like hue, lightness, and chroma.

These functions already exist, and are implemented in all major browsers:

- [`CIE Lab` and `CIE LCH`](https://drafts.csswg.org/css-color-4/#specifying-lab-lch)
- [`Oklab` and `Oklch`](https://drafts.csswg.org/css-color-4/#specifying-oklab-oklch)

> Specifically, I could use something like `calc()` with lum to produce different shades of P3 color.

That also exists, and is called [Relative Color Syntax](https://drafts.csswg.org/css-color-5/#relative-colors). Implemented in Safari and Chrome, and coming soon to Firefox.



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


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

Received on Wednesday, 20 December 2023 16:39:52 UTC