wcag.ts

WCAG 2.x relative luminance and contrast ratio.

Design-time and test use only, like oklch.ts — these power the contrast gates that assert readable default pairings (body text on surfaces, links, focus outlines) across the derived palette.

view source

Declarations
#

2 declarations

srgb_relative_luminance
#

wcag.ts view source

([r, g, b]: RgbUnit): number import {srgb_relative_luminance} from '@fuzdev/fuz_css/wcag.js';

Computes WCAG 2.x relative luminance of a gamma-encoded sRGB color.

__0

type RgbUnit

returns

number

wcag_contrast_ratio
#

wcag.ts view source

(a: RgbUnit, b: RgbUnit): number import {wcag_contrast_ratio} from '@fuzdev/fuz_css/wcag.js';

Computes the WCAG 2.x contrast ratio between two gamma-encoded sRGB colors, in [1, 21] regardless of argument order.

a

type RgbUnit

b

type RgbUnit

returns

number

Depends on
#