parcel-bundler / lightningcss

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

lowering for `oklch` does not work when using numeric or mixed values #809

Open mayank99 opened 3 weeks ago

mayank99 commented 3 weeks ago

Currently, lightningcss lowers the following correctly (albeit with an unnecessary conversion from oklch to lab):

--color-1: oklch(100% none none);
--color-2: oklch(100% 0 0);

Whereas the following are ignored completely:

--color-3: oklch(1 0 0);
--color-4: oklch(100% 0% 0deg);

See playground.

I came across a similar issue (#445) which was closed by https://github.com/parcel-bundler/lightningcss/commit/835e5bc68da7ecc7c2e59b20617eed56465f9045, but it doesn't work in the latest version.

mayank99 commented 1 week ago

Aside: should the extra conversion from oklch to lab be considered a bug?

There could be some slight differences between the color formats. I noticed a difference in precision too. For example, oklch(99.06% 0.002 247.84) becomes lab(98.9092% -.247002 -.70672).