---
name: "accessibility-contrast-audit"
description: "Calculate text contrast for supplied colors and document the rendered context. Use when the user needs: Get contrast ratios, applicable thresholds and candidate color adjustments."
metadata: {"version": "2026-10-17.1", "category": "design-media", "publisher": "AIDiveForge"}
---

# Accessibility Contrast Audit

Get contrast ratios, applicable thresholds and candidate color adjustments.

## Requirements

Provide foreground/background colors and text size/weight; rendered pages require browser access.

## Workflow

1. Resolve actual foreground and background colors, including opacity, layered backgrounds and interaction states.
2. Convert sRGB channels to linear light and calculate relative luminance and (L1+0.05)/(L2+0.05).
3. Compare with the applicable WCAG text threshold: 4.5:1 for normal text, 3:1 for qualifying large text.
4. Propose a small color adjustment and recalculate it against the same background.
5. Inspect the rendered result and report context that a flat color calculation cannot establish.

## Worked example

Read `examples/input.txt` and `examples/expected.txt` before adapting the workflow.

## Acceptance checks

Compare using the unrounded ratio; 4.48 must not be rounded up to a 4.5 pass.

## Limits

This checks text contrast, not complete WCAG conformance. Gradients, images, transparency and non-text controls require their own context checks.

Worked example included. Model-specific performance and vendor compatibility have not been benchmarked.
