Skip to main content

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

Project description

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

Project details


Release history Release notifications | RSS feed

This version

0.9

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for wcag-contrast-ratio, version 0.9
Filename, size File type Python version Upload date Hashes
Filename, size wcag-contrast-ratio-0.9.tar.gz (2.1 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page