Implementing newer CSS color machinery
https://drafts.csswg.org/css-color-4 and https://drafts.csswg.org/css-color-5 has quite a few things that we don't support atm.
While a lot of them wouldn't be useful, some would be nice to have, and allow to replace GTK-specific alpha() and so on.
The specific things:
- New rgb() etc syntax (https://drafts.csswg.org/css-color-4/#color-syntax-modern - necessary for relative colors, see below)
- lab/lch/oklab/oklch color spaces (https://drafts.csswg.org/css-color-4/#specifying-lab-lch)
- color-mix() (https://drafts.csswg.org/css-color-5/#color-mix)
- Relative colors (https://drafts.csswg.org/css-color-5/#relative-colors)
There is also color()
for arbitrary color spaces, tho I'm not sure how useful that is here. For comparison, oklab etc have a very specific use case of deriving colors from other colors and not having them look terrible like happens so often with shade()
Other functions: light-dark()
would need style providers to know if the current app is light or dark + doesn't work when an app is partially light and partially dark, and we already have many ways to have separate colors for light and dark, so doesn't seem useful. color-contrast()
could be useful, but it doesn't allow to specify which exactly colors to choose between, so once again doesn't seem useful enough.
There's also specifying color space for gradients, transitions etc, that may be easy to add once color-mix()
is there but I haven't looked at it in detail.
A big question is gamut mapping - I don't have an hdr monitor, so I'm not sure what's already there/not. I see there is some code in color-profile-rebased branch, but not sure how much is there atm.
-
new syntax for rgb()
etc -
calc() support -
color-mix() with srgb and hsl color spaces -
relative colors -
missing components -
color() -
hwb -
oklab, oklch -
lab, lch -
linear-srgb -
xyz -
other colorspaces -
gamut mapping -
interpolation color spaces for gradients, etc -
hdr color spaces