Skip to content

gsnedders/wcag-contrast-ratio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wcag-contrast-ratio

A library for computing contrast ratios, as required by WCAG 2.0.

Usage

Simple usage follows this pattern:

>> import wcag_contrast_ratio as contrast
>> black = (0.0, 0.0, 0.0)
>> white = (1.0, 1.0, 1.0)
>> contrast.rgb(black, white)
21.0

Two useful helper functions are provided, to check if contrast meets the required level:

>> import wcag_contrast_ratio as contrast
>> contrast.passes_AA(21.0)
True
>> contrast.passes_AAA(21.0)
True

About

A library for computing contrast ratios, as required by WCAG 2.0

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages