Modify alpha opacity of LESS variable

我的梦境 提交于 2019-12-20 08:19:57

问题


Using LESS, I know that I can change the saturation or tint of a color variable. That looks like this:

background: lighten(@blue, 20%);

I want to change the alpha opacity of my color, though. Preferably like this:

background: alpha(@blue, 20%);

Is there a simple way to do this in LESS?


回答1:


The site documentation gives the answer:

background: fade(@blue, 20%);

The function name is fade not alpha according to that document.




回答2:


For completeness

fade

Set the absolute transparency of a color. Can be applied to colors whether they already have an opacity value or not.

background: fade(@blue, 20%);

fadein

Decrease the transparency (or increase the opacity) of a color, making it more opaque.

background: fadein(@blue, 80%);

fadeout

Increase the transparency (or decrease the opacity) of a color, making it less opaque. To fade in the other direction use fadein.

background: fadeout(@blue, 20%);

Source



来源:https://stackoverflow.com/questions/12771102/modify-alpha-opacity-of-less-variable

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