Using CSS custom properties (variables) with LESS functions

匿名 (未验证) 提交于 2019-12-03 01:40:02

问题:

In my LESS file, I have this:

:root{    --base-color: red; } 

In my project --base-color may change "on the fly" from a user input so every instance of red may become for example green. The problem is I have some LESS functions for applying tint, shadow or saturations so I'm trying to do something like this:

.tint{     color: tint(var(--base-color), 80%); } 

But I receive this error:

Error: error evaluating function tint: color2.toHSL is not a function

Obviously I can't store --base-color in a less variables because I would lose the instance of the variable, so color: tint(@base-color, 80%) is not an acceptable answer.

Is there a way to keep the instance of --base-color in my css minified field?

Thanks.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!