cereja-project / cereja

Cereja is a bundle of useful functions we don't want to rewrite and .. just pure fun!
MIT License
28 stars 12 forks source link

WCAG Contrast Checker Module #215

Closed AnaFerreira015 closed 1 month ago

AnaFerreira015 commented 2 months ago

Key Features:

  1. WCAG Contrast Compliance:

    • Automatically checks if color pairs meet AA and AAA contrast requirements.
    • Distinguishes between small text (default) and large text (≥ 18pt or ≥ 14pt if bold).
  2. Flexible Color & Font Input:

    • Accepts colors in various formats: Hex (#FFFFFF), RGB tuples, or custom Color objects.
    • Supports font sizes in px, pt, em, or rem, accounting for bold fonts.
  3. Detailed Contrast Results:

    • Outputs pass/fail results for both small text and large text at AA and AAA levels.
    • Example result:
      {
      "Element Type": {
      "Small Text": {"AA": "Pass", "AAA": "Fail"},
      "Large Text": {"AA": "Pass", "AAA": "Pass"}
      },
      "contrast_ratio": "15.3:1"
      }

Test Coverage:

WCAG Techniques: