Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
WCAG contrast ratio measurement and scoring
JavaScript
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
test
.travis.yml
README.md
index.js
package.json

README.md

Build Status

wcag color constrast

WCAG contrast ratio measurement and scoring.

api

luminance(a, b)

Return contrast as a numeric ratio given two relative luminances

rgb(a, b)

Return contrast as a numeric ratio given two rgb triplets

score(contrast)

Return score in ('AAA', 'AA', '') given contrast ratio as number.

example

var contrast = require('wcag-contrast');
var ratio = contrast.rgb([0, 0, 0], [255, 255, 255]); // is 21
var score = contrast.score(ratio); // is 'AAA'
Something went wrong with that request. Please try again.