colora11y

1.4.0 • Public • Published

Build Status Coverage Status

colora11y

colora11y is a simple JavaScript color contrast calculator created and maintained by Matt Long.

Usage

colora11y.calcContrastCompliance('#CCCCCC', '00FF00');
// also supports rgb
colora11y.calcContrastCompliance('rgb(204,204,204)', '00FF00');
/*
would return the following:
{
    "aa": {
        "normal":{
            "min":"4.5:1",
            "pass":false
        },
        "large":{
            "min":"3:1",
            "pass":false
        },
        "nontext":{
            "min":"3:1",
            "pass":false
        }
    },
    "aaa":{
        "normal":{
            "min":"7:1",
            "pass":false
        },
        "large":{
            "min":"4.5:1",
            "pass":false
        }
    },
    "ratio":"1.17:1"
}
*/

License

ColorA11y is licensed under the MIT License.

Package Sidebar

Install

npm i colora11y

Weekly Downloads

1

Version

1.4.0

License

MIT

Unpacked Size

63.4 kB

Total Files

15

Last publish

Collaborators

  • longmatthewh