Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WCAG Contrast Checker Module #215

Merged
merged 7 commits into from
Oct 2, 2024
Merged

Conversation

AnaFerreira015
Copy link
Contributor

@AnaFerreira015 AnaFerreira015 commented Sep 19, 2024

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).
  1. 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.
  1. 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:

  • Comprehensive unit tests check contrast compliance with WCAG standards for various color combinations and font sizes.
  • Typography converters (e.g., px_to_pt, em_to_pt) are thoroughly tested to ensure accurate unit conversion.

WCAG Techniques:

  • G18: Ensuring sufficient text contrast (AA and AAA compliance).
  • G145: Meeting contrast requirements for large-scale text.

@AnaFerreira015 AnaFerreira015 added the enhancement New feature or request label Sep 19, 2024
@AnaFerreira015 AnaFerreira015 self-assigned this Sep 19, 2024
@AnaFerreira015 AnaFerreira015 changed the title Adds contrast calculation to WCAG module WCAG Contrast Checker Module Sep 19, 2024
@jlsneto jlsneto merged commit a115dd3 into master Oct 2, 2024
5 checks passed
@jlsneto jlsneto deleted the feature/add-accessibility-module branch October 2, 2024 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants