作者:allmon白_980 | 来源:互联网 | 2023-01-05 20:48
ThismaybeCompass101,buthasanyonewrittenamixinwhichsetsthealphavalueofacolor?Ideal
This may be Compass 101, but has anyone written a mixin which sets the alpha value of a color? Ideally, I would like the mixin to take any form of color definition, and apply transparency:
这可能是Compass 101,但是有没有人编写了一个混合,它设置了颜色的alpha值?理想情况下,我希望mixin采取任何形式的颜色定义,并应用透明度:
@include set-alpha( red, 0.5 ); //prints rgba(255, 0, 0, 0.5);
@include set-alpha( #ff0000, 0.5 ); //prints rgba(255, 0, 0, 0.5);
@include set-alpha( rgb(255,0,0), 0.5 ); //prints rgba(255, 0, 0, 0.5);
4 个解决方案