Contrastify is a tool built to facilitate color contrast checking, ensuring that designs are not only aesthetically pleasing but also accessible to all users (WCAG guidelines), including those with visual impairments.
git clone https://github.com/Ahmed-Jabrane/Contrastify.git
cd Contrastify
pip install -e .
from contrastify import compute_contrast, check_wcag_norms
from contrastify.utils import hex_to_rgb
color1 = hex_to_rgb("#FFFFFF") # White
color2 = hex_to_rgb("#000000") # Black
contrast_ratio = compute_contrast(color1, color2)
print(f"Contrast Ratio: {contrast_ratio:.2f}")
wcag_results = check_wcag_norms(contrast_ratio)
for norm, meets_criteria in wcag_results.items():
status = "meets" if meets_criteria else "does not meet"
print(f"The contrast ratio {status} the {norm} criteria.")
Guidelines for contributing to "Contrastify". Direct readers to CONTRIBUTING.md
for detailed instructions.
Contrastify is under the MIT License. See LICENSE
file for more details.
To understand more about the importance of color contrast and accessibility guidelines, refer to the following resources: The WCAG guidelines provide extensive recommendations for making web content more accessible. These guidelines are used globally and form the basis for many regional accessibility laws and policies. (Web Content Accessibility Guidelines (WCAG))