You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using UnoCSS with Scss, there is an inconsistency in how colors are handled when retrieved using the theme function. While variables defined directly as colors ($v1: blue;) behave as expected, those retrieved through the theme('colors.blue.500') function are not recognized as colors in certain Sass functions such as mix, transparentize, and rgba. This inconsistency leads to errors when attempting to manipulate colors retrieved via the theme function.
Reproduction
$v1: blue;
$v2: theme('colors.blue.500');
.a1 {
background: $v1; //okbackground: $v2; //okbackground: mix($v1, #fff, 0.5); //okbackground: transparentize($v1, 0.5); //okbackground: rgba($v1, 0.5); //okbackground: mix($v2, #fff, 0.5); //no $color1: theme("colors.blue.500") is not a color.background: transparentize($v2, 0.5); //no $color1: theme("colors.blue.500") is not a color.background: rgba($v2, 0.5); //no $color1: theme("colors.blue.500") is not a color.
}
Sass, Less, Stylus, and other preprocessors run separately before UnoCSS. This means that you cannot input the output of the theme() function into Sass color functions, as theme() is only truly calculated after your Sass has been compiled to CSS and input into UnoCSS.
UnoCSS version
0.58.5
Describe the bug
When using UnoCSS with Scss, there is an inconsistency in how colors are handled when retrieved using the theme function. While variables defined directly as colors ($v1: blue;) behave as expected, those retrieved through the theme('colors.blue.500') function are not recognized as colors in certain Sass functions such as mix, transparentize, and rgba. This inconsistency leads to errors when attempting to manipulate colors retrieved via the theme function.
Reproduction
System Info
No response
Validations
The text was updated successfully, but these errors were encountered: