快速入门
概览
变量(Variables)
混合(Mixins)
嵌套(Nesting)
运算(Operations)
转义(Escaping)
函数(Functions)
命名空间和访问符
映射(Maps)
作用域(Scope)
注释(Comments)
导入(Importing)
Less.js 用法
命令行用法
浏览器使用
Less.js选项
预装插件
程序化使用
API
Contributing to Less.js
Less 函数手册
逻辑函数
字符串函数
列表函数
数学函数
类型函数
其他功能
颜色定义函数
颜色通道函数
颜色操作函数
颜色混合函数
进阶指南
合并
父选择器
扩展
变量
Mixins
CSS Guards
Detached Rulesets
@import At-Rules
@plugin At-Rules
Maps (NEW!)
Less入门文档
网站首页
颜色通道函数
### hue Extracts the hue channel of a color object in the HSL color space. Parameters: `color` - a color object. Returns: `integer` 0-360 Example: `hue(hsl(90, 100%, 50%))` Output: `90` ### saturation Extracts the saturation channel of a color object in the HSL color space. Parameters: `color` - a color object. Returns: `percentage` 0-100 Example: `saturation(hsl(90, 100%, 50%))` Output: `100%` ### lightness Extracts the lightness channel of a color object in the HSL color space. Parameters: `color` - a color object. Returns: `percentage` 0-100 Example: `lightness(hsl(90, 100%, 50%))` Output: `50%` ### hsvhue Extracts the hue channel of a color object in the HSV color space. Parameters: `color` - a color object. Returns: `integer` 0-360 Example: `hsvhue(hsv(90, 100%, 50%))` Output: `90` ### hsvsaturation Extracts the saturation channel of a color object in the HSV color space. Parameters: `color` - a color object. Returns: `percentage` 0-100 Example: `hsvsaturation(hsv(90, 100%, 50%))` Output: `100%` ### hsvvalue Extracts the value channel of a color object in the HSV color space. Parameters: `color` - a color object. Returns: `percentage` 0-100 Example: `hsvvalue(hsv(90, 100%, 50%))` Output: `50%` ### red Extracts the red channel of a color object. Parameters: `color` - a color object. Returns: `float` 0-255 Example: `red(rgb(10, 20, 30))` Output: `10` ### green Extracts the green channel of a color object. Parameters: `color` - a color object. Returns: `float` 0-255 Example: `green(rgb(10, 20, 30))` Output: `20` ### blue Extracts the blue channel of a color object. Parameters: `color` - a color object. Returns: `float` 0-255 Example: `blue(rgb(10, 20, 30))` Output: `30` ### alpha Extracts the alpha channel of a color object. Parameters: `color` - a color object. Returns: `float` 0-1 Example: `alpha(rgba(10, 20, 30, 0.5))` Output: `0.5` ### luma Calculates the luma (perceptual brightness) of a color object. Uses SMPTE C / Rec. 709 coefficients, as recommended in WCAG 2.0. This calculation is also used in the contrast function. Before v1.7.0 the luma was calculated without gamma correction, use the luminance function to calculate these "old" values. Parameters: `color` - a color object. Returns: `percentage` 0-100% Example: `luma(rgb(100, 200, 30))` Output: `44%` ### luminance Calculates the value of the luma without gamma correction (this function was named luma before v1.7.0) Parameters: `color` - a color object. Returns: `percentage` 0-100% Example: `luminance(rgb(100, 200, 30))` Output: `65%`
上一篇:
颜色定义函数
下一篇:
颜色操作函数