LESS中的颜色定义函数使定义和操作颜色变得超级简单,使用颜色函数可以帮助你控制颜色、更好地配色。
LESS提供了许多有用的颜色函数,以不同的方式改变和操作颜色。 LESS支持一些颜色定义功能,如下表所示:
S.N. | 函数及描述 | 例子 |
---|---|---|
1 | rgb 它创建从红色,绿色和蓝色值的颜色。 它有以下参数:
| rgb(220,20,60)它使用rgb值将颜色转换为: #dc143c |
2 | rgba It determines color from red, green, blue and alpha values. It has following parameters:
| rgba(220,20,60,0.5)它使用rgba值将颜色对象转换为: rgba(220,20,60,0.5) |
3 | argb It defines hex representation of color in #AARRGGBB format. It uses below parameter:
| argb(rgba(176,23,31,0.5))它返回argb颜色为: #80b0171f |
4 | hsl It generates the color from hue, saturation and lightness values. It has following parameters:
| hsl(120,100%,50%)它使用HSL值返回颜色对象: #00ff00 |
5 | hsla It generates the color from hue, saturation, lightness and alpha values. It has following parameters:
| hsla(0,100%,50%,0.5)它使用HSLA值将颜色对象指定为: rgba(255,0,0,0.5); |
6 | hsv It produces the color from hue, saturation and value values. It contains following parameters:
| hsv(80,90%,70%)它将具有hsv值的颜色对象转换为: #7db312 |
7 | hsvaIt produces the color from hue, saturation, value and alpha values. It uses following parameters:
| hsva(80,90%,70%,0.6)它指定具有hsva值的颜色对象为: rgba(125,179,18,0.6) |