WCAG contrast ratio measurement and scoring
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
test added ability to check contrast score from hex value Sep 18, 2015
.gitignore added hex check Sep 18, 2015
.travis.yml First Sep 5, 2013
CHANGELOG.md Add changelog Sep 18, 2015
README.md
index.js
package.json

README.md

Build Status

wcag color constrast

WCAG contrast ratio measurement and scoring.

API

luminance

Get the contrast ratio between two relative luminance values

Parameters

Examples

luminance(1, 1); // = 1

Returns number contrast ratio

rgb

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

hex

Get a score for the contrast between two colors as hex strings

Parameters

Examples

hex('#000', '#fff'); // = 21

Returns number contrast ratio

score

Get a textual score from a numeric contrast value

Parameters

Examples

score(10); // = 'AAA'

Returns string score