Closed meza closed 1 month ago
Custom color formats are disregarded in the generated css. Currently it all gets converted to lab
lab
When using any custom color format like hls or oklch, the generated CSS should retain those formats.
hls
oklch
Using:
win32-x64 vite/5.2.10 node-v21.7.1 stylex: 0.6.1 vite-plugin-stylex-dev: 0.6.1 remix: 2.9.1
Define color variables that use specific color formats.
import * as stylex from '@stylexjs/stylex'; const hues = { amber: 73.12 }; export const colours = stylex.defineVars({ amber01: 'hsl(45,88%,6%)', amber02: `oklch(22.05% 0.046 ${hues.amber}deg)`, amber03: `oklch(25.32% 0.056 ${hues.amber}deg)`, amber04: `oklch(28.43% 0.0638 ${hues.amber}deg)`, amber05: `oklch(31.66% 0.0709 ${hues.amber}deg)`, amber06: `oklch(35.74% 0.0786 ${hues.amber}deg)`, amber07: `oklch(40.86% 0.088 ${hues.amber}deg)`, amber08: `oklch(47.33% 0.1045 ${hues.amber}deg)`, amber09: `oklch(81.69% 0.1638 ${hues.amber}deg)`, amber10: `oklch(86.59% 0.1539 ${hues.amber}deg)`, amber11: `oklch(76.93% 0.162 ${hues.amber}deg)`, amber12: `oklch(96.7% 0.031 ${hues.amber}deg)` });
I tried with the vite-stylex-plugin and I tried with the vite-stylex-plugin-dev. My styles that aren't through stylex come out untouched on the other end of my build chain, as expected.
What I just realised is that it gets converted to rgb as a default!
Ignore this, lightningcss was the culprit!
Describe the issue
Custom color formats are disregarded in the generated css. Currently it all gets converted to
lab
Expected behavior
When using any custom color format like
hls
oroklch
, the generated CSS should retain those formats.Steps to reproduce
Using:
win32-x64 vite/5.2.10
node-v21.7.1 stylex: 0.6.1 vite-plugin-stylex-dev: 0.6.1 remix: 2.9.1
Define color variables that use specific color formats.
Test case
Additional comments
I tried with the vite-stylex-plugin and I tried with the vite-stylex-plugin-dev. My styles that aren't through stylex come out untouched on the other end of my build chain, as expected.