color-function-alias-notation
为颜色函数指定别名符号。
¥Specify alias notation for color-functions.
a { color: rgb(0 0 0 / 0.2) }
/** ↑
* This notation */
颜色函数 rgb() 和 hsl() 有别名 rgba() 和 hsla()。这些完全等效,最好 使用不带 a 的第一个变体。
¥Color functions rgb() and hsl() have aliases rgba() and hsla(). Those are exactly equivalent, and it's preferable to use the first variant without a.
fix 选项 可以自动修复此规则报告的所有问题。
¥The fix option can automatically fix all of the problems reported by this rule.
选项
¥Options
"without-alpha"
适用的颜色函数必须始终使用不带 alpha 符号。
¥Applicable color-functions must always use the without alpha notation.
{
"color-function-alias-notation": "without-alpha"
}
以下模式被视为问题:
¥The following patterns are considered problems:
a { color: rgba(0 0 0) }
a { color: hsla(270 60% 50% / 15%) }
以下模式不被视为问题:
¥The following patterns are not considered problems:
a { color: rgb(0 0 0) }
a { color: hsl(270 60% 50% / 15%) }
"with-alpha"
适用的颜色函数必须始终使用带 alpha 符号。
¥Applicable color-functions must always use with alpha notation.
{
"color-function-alias-notation": "with-alpha"
}
以下模式被视为问题:
¥The following patterns are considered problems:
a { color: rgb(0 0 0) }
a { color: hsl(270 60% 50% / 15%) }
以下模式不被视为问题:
¥The following patterns are not considered problems:
a { color: rgba(0 0 0) }
a { color: hsla(270 60% 50% / 15%) }