A library for computing contrast ratios, as required by WCAG 2.0
Find a file
2015-07-30 22:52:32 +01:00
wcag_contrast_ratio Oh, seemingly the spec means luma when it says "lighter" ambiguously. 2015-07-30 22:35:25 +01:00
.gitignore Just some code. 2015-07-30 22:13:36 +01:00
.travis.yml Say hello to tox and Travis CI. Fixes #1. 2015-07-30 22:48:35 +01:00
LICENSE Just some code. 2015-07-30 22:13:36 +01:00
MANIFEST.in We want to ship the README and the tests. 2015-07-30 22:48:21 +01:00
README.rst Just some code. 2015-07-30 22:13:36 +01:00
setup.py Just some code. 2015-07-30 22:13:36 +01:00
test.py Fix this test to pass arguments both ways around. 2015-07-30 22:52:32 +01:00
tox.ini Say hello to tox and Travis CI. Fixes #1. 2015-07-30 22:48:35 +01:00

wcag-contrast-ratio
===================

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

Usage
-----

Simple usage follows this pattern:

.. code-block:: python

  >> 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:

.. code-block:: python

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

.. _WCAG 2.0: http://www.w3.org/TR/WCAG20/