parcel-bundler / lightningcss

An extremely fast CSS parser, transformer, bundler, and minifier written in Rust.
https://lightningcss.dev
Mozilla Public License 2.0
6.33k stars 178 forks source link

CSS Color Level 5 #99

Open devongovett opened 2 years ago

devongovett commented 2 years ago

v1.5.0 adds support for level 4, let's add support for level 5 as well: https://drafts.csswg.org/css-color-5/

Not sure how stable the spec is. I think Firefox and Safari already have implementations of some of this under a flag.

svgeesus commented 2 years ago

Safari TP has support for color-mix(), color-contrast() and RCS. Firefox and Chrome are investigating color-mix() although one of those implementations is currently sRGB-only at the moment.

Support for CSS Color 4 and (parts of) CSS Color 5, specifically color-mix( and color-contrast() is part of Interop 2022 (see also Safari blog post on Interop 2022) so the latest versions of all major browsers are aiming to support this by the end of this year!

Which will intensify the support need for older browsers.

No browser currently has support for @color-profile or device-cmyk and those parts of the spec are not part of Interop 2022; but support is showing up in the CSS-to-PDF converters. So I could see down-conversion in parcel-css being useful for people targeting print/ebooks as well as Web.

devongovett commented 2 years ago

Implemented the relative color syntax in 44a402da404436fbaed684edfc569e99a4403a0f, passing the tests from WPT. 🥳 Only limitation is that it cannot work with variables due to being a build-time transform.

hare0319 commented 11 months ago

Implemented the relative color syntax in 44a402d, passing the tests from WPT. 🥳 Only limitation is that it cannot work with variables due to being a build-time transform.

Em... Is there a way to perform this, now? Thanks

LinusU commented 1 week ago

I've submitted #808 for the contrast-color from CSS Color Level 6, which is the evolution of color-contrast() from Level 5 mentioned in the op here 🚀