Nitrogen Poisonous Monoxide
Have opinions about JavaScript? We want to hear them. Take the 2018 JavaScript Ecosystem Survey »

wcag-contrast

2.1.1 • Public • Published

wcag color contrast

CircleCI

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

install

npm i wcag-contrast

Downloadsweekly downloads

2,915

version

2.1.1

license

BSD-2-Clause

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability