📜  LESS-颜色通道功能

📅  最后修改于: 2020-10-22 07:15:26             🧑  作者: Mango


 

在本章中,我们将了解LESS中颜色通道功能的重要性。 LESS支持一些内置功能,这些功能可以为通道设置值。通道根据颜色定义设置值。 HSL颜色具有色相,饱和度和亮度通道,而RGB颜色具有红色,绿色和蓝色通道。下表列出了所有颜色通道功能-

Sr.No. Function & Description Example
1 hue

In HSL color space, the hue channel is extracted off the color object.

background: hue(hsl(75, 90%, 30%));

It compiles in the CSS as shown below −

background: 75;
2 saturation

In HSL color space, the saturation channel is extracted off the color object.

background: saturation(hsl(75, 90%, 30%));

It compiles in the CSS as shown below −

background: 90%;
3 lightness

In HSL color space, the lightness channel is extracted off the color object.

background: lightness(hsl(75, 90%, 30%));

It compiles in the CSS as shown below −

background: 30%;
4 hsvhue

In HSV color space, the hue channel is extracted off the color object.

background: hsvhue(hsv(75, 90%, 30%));

It compiles in the CSS as shown below −

background: 75;
5 hsvsaturation

In HSL color space, the saturation channel is extracted off the color object.

background: hsvsaturation(hsv(75, 90%, 30%));

It compiles in the CSS as shown below −

background: 90%;
6 hsvvalue

In HSL color space, the value channel is extracted off the color object.

background: hsvvalue(hsv(75, 90%, 30%));

It compiles in the CSS as shown below −

background: 30%;
7 red

The red channel is extracted off the color object.

background: red(rgb(5, 15, 25));

It compiles in the CSS as shown below −

background: 5;
8 green

The green channel is extracted off the color object.

background: green(rgb(5, 15, 25));

It compiles in the CSS as shown below −

background: 15;
9 blue

The blue channel is extracted off the color object.

background: blue(rgb(5, 15, 25));

It compiles in the CSS as shown below −

background: 25;
10 alpha

The alpha channel is extracted off the color object.

background: alpha(rgba(5, 15, 25, 1.5));

It compiles in the CSS as shown below −

background: 2;
11 luma

luma value is calculated off a color object.

background: luma(rgb(50, 250, 150));

It compiles in the CSS as shown below −

background: 71.2513323%;
12 luminance

The luma value is calculated without gamma correction.

background: luminance(rgb(50, 250, 150));

It compiles in the CSS as shown below −

background: 78.53333333%;