wcag-contrast

evaluate the wcag color contrast score for two colors

WCAG contrast ratio measurement and scoring.

Return contrast as a numeric ratio given two relative luminances

Return contrast as a numeric ratio given two rgb triplets

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

var contrast = require('wcag-contrast');
var ratio = contrast.rgb([0, 0, 0], [255, 255, 255]); // is 21 
var score = contrast.score(ratio); // is 'AAA'