Skip to main content

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.

message 次要选项 可以接受该规则的参数。

¥The message secondary option can accept the arguments of this rule.

选项

¥Options

string"without-alpha"|"with-alpha"

"without-alpha"

适用的颜色函数必须始终使用不带 alpha 符号。

¥Applicable color-functions must always use the without alpha notation.

以下模式被视为问题:

¥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.

以下模式被视为问题:

¥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%) }