-
Notifications
You must be signed in to change notification settings - Fork 244
Description
The lab(), lch(), oklab() and oklch() functional notations support a numeric value for the L component. However, lightningcss only supports percentage values for those components, and bails out if a number is used.
In other words, these two declarations should be equivalent and lowered to background: #777:
.lch-percentage {
background: lch(50% 0 223.97);
}
/* This is a valid representation as well (L [0,100] for lch()) */
.lch-number {
background: lch(50 0 223.97);
}But this is the output instead:
.lch-percentage {
background: #777;
background: lch(50% 0 223.97);
}
/* Stays intact, instead of being lowered */
.lch-number {
background: lch(50 0 223.97);
}Link to the playground, showing the lack of lowering for the numeric L component
Expected behaviour
lch()should allow numeric values of [0,100] for the L componentlab()should allow numeric values of [0,100] for the L componentokch()should allow numeric values of [0,1] for the L componentoklab()should allow numeric values of [0,1] for the L component
Note the difference in the numeric range: lch() and lab() define them as [0,100] corresponding to 0% and 100%, while oklch and oklab define them as [0,1.0] corresponding to 0% and 100%.
Reference for lch() and lab() numeric range
Reference for oklch() and oklab() numeric range
Please let me know if there is any other information that I can provide, or whether I missed something! I would be happy to contribute a PR for this :)