Scientific notation causes error in OKLCH?
Closed this issue · 2 comments
LeaVerou commented
Discussed in #507
Originally posted by maybebansky April 26, 2024
I'm using scientific notation for color channels that I pass to the Color object in the OKLCH format.
I know it's a bit weird but I'm getting these values as a result of color manipulation elsewhere in my app.
// This works fine
const color1 = new Color("oklch(50% 4 30)");
// This errors
const color2 = new Color("oklch(50% 4.0e-1 30)");
"oklch(50% 4.0e-1 30)"
does appear to be valid CSS so is this technically a bug (albeit it an edge case)?
The error is
Uncaught TypeError: undefined not allowed for Chroma in oklch()
facelessuser commented
Yes. This is now fixed.