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
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file wcag-contrast-ratio-0.9.tar.gz.
File metadata
- Download URL: wcag-contrast-ratio-0.9.tar.gz
- Upload date:
- Size: 2.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
69192b8e5c0a7d0dc5ff1187eeb3e398141633a4bde51c69c87f58fe87ed361c
|
|
| MD5 |
5ad2879d24d8558e3ac67843091da33b
|
|
| BLAKE2b-256 |
1fecfaf3e7ee407a00081372632cdd9858302c8a9bb071e3767f8dac2ac3f9e2
|