WCAG contrast ratio measurement and scoring.
Get the contrast ratio between two relative luminance values
Parameters
Examples
luminance(1, 1); // = 1
Returns number contrast ratio
Get a score for the contrast between two colors as rgb triplets
Parameters
Examples
rgb([0, 0, 0], [255, 255, 255]); // = 21
Returns number contrast ratio
Get a score for the contrast between two colors as hex strings
Parameters
Examples
hex('#000', '#fff'); // = 21
Returns number contrast ratio
Get a textual score from a numeric contrast value
Parameters
contrast
number
Examples
score(10); // = 'AAA'
Returns string score