Skip to content

Ultra lightweight library to check for WCAG2 compliance

License

Notifications You must be signed in to change notification settings

motleydev/color-check

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Color Check

travis js-standard-style Commitizen friendly codecov

Color Check is a very tiny library for checking your foreground and backgrounds colors against the WCAG2 color compliance standard. There are a range of methods which can be found in the docs including returning the actual values used in calculating the AA, AA 18, AAA and AAA 18 standards as well as color contrast and color difference checks.

There are other libraries such as the excellent color package which will parse any valid css color syntax and provide methods for checking the values needed. This library is smaller and returns boolean values where possible. Being smaller, it requires you to provide the valid hex string or rgb color object. Errors will simply fail.

Getting Started

npm install color-check

Usage

var colorCheck = require('color-check');
colorCheck.aa('#000000', {r:0, g:0, b: 0}) // returns true

For other methods, see the docs

Good accessibility means good UX for everyone!

Enjoy!


MIT License

About

Ultra lightweight library to check for WCAG2 compliance

Resources

License

Stars

Watchers

Forks

Packages

No packages published