LESS中的顏色定義函數(shù)使定義和操作顏色變得超級簡單,使用顏色函數(shù)可以幫助你控制顏色、更好地配色。
LESS提供了許多有用的顏色函數(shù),以不同的方式改變和操作顏色。 LESS支持一些顏色定義功能,如下表所示:
S.N. | 函數(shù)及描述 | 例子 |
---|---|---|
1 | rgb
它創(chuàng)建從紅色,綠色和藍(lán)色值的顏色。 它有以下參數(shù):
|
rgb(220,20,60)它使用rgb值將顏色轉(zhuǎn)換為: #dc143c
|
2 | rgba
It determines color from red, green, blue and alpha values. It has following parameters:
|
rgba(220,20,60,0.5)它使用rgba值將顏色對象轉(zhuǎn)換為: 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值的顏色對象轉(zhuǎn)換為: #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)
|
更多建議: