Skip to main content

Function: contrastRatio()

function contrastRatio(a, b): number;

Defined in: contrast.ts:161

WCAG 2.x contrast ratio between two colours, 1–21. Translucent inputs are composited (background over white, then foreground over the resulting background) per docs/12 §9, so rgba(0,0,0,0.5) on white scores like the grey it actually paints rather than like black.

Parameters

ParameterType
astring
bstring

Returns

number