After working on a separate PR to get back insight on what color manipulations we do and how we do them before getting back to this issue here. I believe the best course of action is to not do this at this time.
There is definitely a way not to need LESS color functions, by breaking down colors into 3 values for HSL, but having done that in the past, it makes the code hard to work with.
The best would be to use the new CSS color functions that support relative changes, mainly hsl
, color
and color-mix
, but the browser support for these is just not there yet, I reckon in 2 - 3 years it might be in a good place, so this is likely something for v3.
For reference:
Example
using darken(@primary-color, 5%)
in less would be equivalent to using the CSS function:
hsl(from var(--primary-color) h s calc(l - 5))
So for now we might just stay on the current backend LESS parsing, until browser support for the new color operations is in a better stage.