Description
Syntax of the content of CSS custom properties is very permissive but that causes problems when using such properties inside builtin functions like rgba()
Example:
My project allows user to define accent color on which the whole app UI and various custom components is based. And I am using rgb format because of the need to fade in certain places and CSS does not provide anything like fade(@color, 50%)
in less. That way i can do rgba( var(--color), 0.5 )
. This works in Chrome and is supported by the standart. However less throws the following error error evaluation function 'rgba': color functions take numbers as parameters
.
Example code:
:root {
--color-accent: 169,57,255;
}
button:hover {
background-color: rgba(var(--color-accent), 0.2);
color: rgb(var(--color-accent));
}
Note: This is a drop-in library and i don't want to force users to add another build step into their workflow only to build my less library with their colors. That's why i'm using the new and shiny custom properties (and also because of its scoping capability).
BTW: Is there some temporary workaround that'd skip such strict handling and build it anyway? It's not like I'm missing a bracket in a nested rules.