Skip to content

UI & Design

Contrast Pairs

Free

Pick text and background pairs that meet WCAG AA, and never encode meaning with color alone.

Difficulty foundational
Version v1.1

Purpose

Catch unreadable gray-on-white and color-only status before shipping UI.

Procedure

--- name: contrast-pairs description: Pick text and background pairs that meet WCAG AA, and never encode meaning with color alone. ---

Contrast Pairs

Purpose

Catch unreadable gray-on-white and color-only status before shipping UI.

Procedure

For every text/background pair you introduce or touch, estimate contrast. Body text and form labels need at least 4.5:1. Large headings (about 24px regular or 19px bold) and meaningful icons need at least 3:1. Placeholder text is not a label and must still be readable if it carries information; prefer a real label and a muted placeholder that is not essential.

Muted secondary text on a white or near-white surface is the usual failure. If the muted token is under 4.5:1, do not use it for text under 18px. Use it for borders and icons that are decorative only.

Status is never color alone. Pair a word ("Failed", "Premium") with the color. Do not rely on red versus green for users who cannot distinguish them.

Focus rings must be visible on both the page background and on dark buttons. Do not remove outlines without replacing them.

Do not ship a contrast "score" you did not compute. If you cannot measure, say so and choose the darker of the two candidate text colors.

Example requests

1. Audit a form

Request: Run Contrast Pairs on the billing form. Fix failures. Do not redesign the layout. Expected: A list of pairs checked and the specific token changes.

Dependencies

None. Work in the repository that is already open. Do not add packages unless the procedure names one.

Compatibility

This document follows the Agent Skills layout (a folder named contrast-pairs containing SKILL.md). Claude Code, Cursor, Codex, and Gemini CLI can load that file from the paths in the Skilling installation guide. GitHub Copilot does not load SKILL.md. Use the Copilot instructions copy, and narrow applyTo before you commit it.

Example prompts

Audit a form

Run Contrast Pairs on the billing form. Fix failures. Do not redesign the layout.

Expected: A list of pairs checked and the specific token changes.

Choose the agent

This skill is installed for one agent at a time. Pick the section you are using.

Related

  • Accessibility Engineering

    Fix semantics, names, focus, and keyboard paths on the UI you are already editing.

  • Design Tokens

    Define color, type, radius, and spacing once, then ban raw values in components.

  • Form States

    Build forms with labels, inline errors, pending submits, and no silent failure.

Reviews

No reviews yet.

    Sign in to review.

    Report a problem

    Inaccurate steps, an unsafe instruction, or a licensing concern.

    Sign in to report.