Skip to main content

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.

This rule supports 2 message arguments: the lightness value and its expected notation.

Options

"percentage"

Lightness must always use the percentage notation.

{
"lightness-notation": "percentage"
}

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.

{
"lightness-notation": "number"
}

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