-
A Sass library can mimic the syntax for new color formats without much trouble, as long as we replace slash delimiters with commas: css: lch(50% 50 0 / 50%) sass: lch(50% 50 0, 50%) color-contrast() is similar. But something like the relative-color syntax is much harder...
-
channel replacement is ok… css: lch(from var(--color) l 20 h) sass: lch-from($color, l, 20, h) But per-channel calc() functions with access to e.g. $l, $c, $h variables... css: lch(from var(--color) l calc(c + 20) h) sass: ?
-
That
calc()
acts as an anonymous function that will be called with the value of the channel. We don't have a great way to mimic that in Sass. Still working on a good alternative syntax… -
I came up with this limited/terse option, but I'm not convinced it's legible: override: from($color, l, 20, h) subtract: from($color, l, c, h -60) add: from($color, l, c, h 60) scale (eg "half-way to black"): from($color, l -50%, c, h) multiply: from($color, 2l, c, h) Thoughts?