Build a Live Accessible Color Palette Builder with a WCAG Contrast Matrix

Get a single HTML palette builder that tests every text-on-background pair, shows AA/AAA badges live, and suggests the nearest passing shade for failures.

You getone complete HTML file in a single code block, then 3 short ideas to extend it.

The prompt

Prompt
You are a senior product designer who writes clean, accessible front-end code. Build 'Contrast Loom', a live accessible palette builder for a coastal brand called Harbor, as one HTML page. Start with six named colors (Ink, Paper, Tide, Coral, Sand, Moss) and show a full matrix where every color is tested as text on every other color as background, using WCAG 2.1 contrast ratios.

Rules:
1. Left panel: each color has a native color picker, an editable name and a hex field. An invalid hex gets a red border and is ignored. Allow 2 to 8 colors, with add, remove and reset buttons.
2. Matrix: rows are text colors and columns are backgrounds. Each cell shows an 'Aa' sample, the ratio to two decimals, and AA and AAA badges with check or cross symbols so color is never the only signal. Diagonal cells say 'Same color'.
3. A toggle switches thresholds between normal text (4.5 and 7) and large text (3 and 4.5). Everything updates live as you type or drag.
4. For each pair that fails AA, suggest the nearest passing shade by shifting only the text color's HSL lightness. Show its ratio and a 'Use' button that applies it.
5. Show a live pass count and a CSS custom properties export block.
6. No external assets or storage. Use system fonts and visible focus outlines. Make it responsive from 360 to 1280px, with the matrix scrolling sideways on small screens.

Output format: one complete HTML file in a single code block, then 3 short ideas to extend it.

Example output

One HTML file. Save it and open it in any browser.Open full screen

Example: Contrast Loom, a live WCAG palette builder for the Harbor brand.

Edit any of the six starter colors with the picker or hex field, and the whole text-on-background matrix updates at once. Each cell shows a sample, the ratio, and AA/AAA badges. Failing pairs suggest the nearest passing shade, and Use applies it. Toggle Large text to relax the thresholds. You can add up to 8 colors, then copy the CSS variables block.

Written by AI from this prompt. Your results will vary.

Tips and common edits

Why this works

  • Tests every ordered pair in a matrix, so no text-on-background combination is missed when one color changes.
  • Suggestions shift only HSL lightness, so the fix keeps the brand's hue and saturation recognizable.
  • Check and cross symbols sit next to the colored badges, so pass and fail still read in grayscale or for color-blind users.

Paste into ChatGPT, Claude or Gemini. Save the code as contrast-loom.html and open it in any browser, or run it in the chat's preview or canvas. Swap the starter colors for your own brand palette.

Common edits

  • Replace the Harbor starter palette with your own brand colors and names.
  • Add a third threshold for UI components (3:1) or a 'show failing pairs only' filter.

Prompt details

By
Prompts-GPT editors
Published
How prompts are written and checked

Did this prompt work?

Keep exploring

More in Design