# color-contrast-check

Check text and UI colour pairs against WCAG contrast ratios (AA/AAA, normal and large text)

- **Space:** accessibility-public (https://github.com/Tech-Realm/space-accessibility-public/tree/main/color-contrast-check)
- **Level:** L2 (as the registry reports it)
- **Keys it needs (names only):** none
- **Tools:** python3
- **Routes:** local-python; checks: 1
- **Uses:** new (no recorded use yet)
- **Install:** `logicpacks pack use accessibility-public/color-contrast-check` or MCP `get_pack accessibility-public/color-contrast-check`
- **Files:** CHANGELOG.md, code/contrast.py, outcome/EVIDENCE.md, outcome/checks.yaml, outcome/fixtures/pairs.txt, outcome/results.json, pack.yaml, spec/SPEC.md, spec/source.md

## Purpose (spec/SPEC.md)

## Goal

Contrast ratio and AA/AAA pass/fail for each foreground/background pair (hex), plus the nearest passing darker/lighter foreground for failures.

Verified by: Known values: #000/#fff = 21.00; #777/#fff = 4.48 (fails AA normal); suggestion for #777 on white passes 4.5.

## Steps

1. List the design's text/background pairs (design tokens).
2. Run `python3 code/contrast.py pairs.txt`.
3. Replace failing colours with the suggested ones or adjust the palette.

## Edge cases

- Transparent colours must be flattened against their background first.
- Text over images needs a check against the worst-case pixel area.

## Don'ts

- Don't claim WCAG conformance from automated checks alone; automated tools catch roughly a third of issues, so do a manual keyboard and screen-reader pass too.



---

Canonical URL: https://logicpacks.io/packs/accessibility-public/color-contrast-check

Developed by TechRealm (techrealm.online), the software team. Operated by Al Jash Trading (Establishment), Abu Dhabi, since 1994, the legal entity that hosts and is responsible for the service. Economic licence CN-1030597, Abu Dhabi Registration Authority. Address: Office 5, Bani Yas West 4, Bani Yas, Abu Dhabi, UAE. Website: https://aljashtrading.com. Contact: hello@logicpacks.io, security@logicpacks.io, WhatsApp +1 713 632 2262 (https://wa.me/17136322262).

Machine-readable index: [/llms.txt](/llms.txt). Plain facts: [/about.md](/about.md). Safety: [/safety.md](/safety.md).
