跳到主要内容

lightness-notation

Specify number or percentage notation for lightness.

    a { color: oklch(85% 0.17 88) }
/** ↑
* This notation */

This rule supports oklch, oklab, lch and lab functions.

The fix option can automatically fix all of the problems reported by this rule.

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

Options

string: "percentage"|"number"

"percentage"

Lightness must always use the percentage notation.

The following patterns are considered problems:

a { color: oklch(0.85 0.17 88) }
a { color: oklab(0.86 0.2 154) }
a { color: lch(85 0.17 88) }
a { color: lab(86 0.2 154) }

The following patterns are not considered problems:

a { color: oklch(85% 0.17 88) }
a { color: oklab(86% 0.2 154) }
a { color: lch(85% 0.17 88) }
a { color: lab(86% 0.2 154) }

"number"

Lightness must always use the number notation.

The following patterns are considered problems:

a { color: oklch(85% 0.17 88) }
a { color: oklab(86% 0.2 154) }
a { color: lch(85% 0.17 88) }
a { color: lab(86% 0.2 154) }

The following patterns are not considered problems:

a { color: oklch(0.85 0.17 88) }
a { color: oklab(0.86 0.2 154) }
a { color: lch(85 0.17 88) }
a { color: lab(86 0.2 154) }