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
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
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
Did this prompt work?
Keep exploring
More like this
Build a Drag-to-Arrange Brand Mood Board with Color, Texture and Type Tiles
A prompt that produces a single HTML mood board of color, texture and type tiles built from CSS and SVG, rearrangeable by mouse, touch and keyboard.
Build a Color Blindness Simulator That Previews a Palette on a Dashboard Card
A single HTML file that redraws a realistic dashboard card under protanopia, deuteranopia, tritanopia and grayscale and flags color pairs that become hard to tell apart.
Build a Draggable Color Harmony Wheel With Live UI Preview in One HTML File
A ready-to-paste prompt that builds a draggable canvas color wheel. It plots complementary, triadic and analogous schemes live and previews each one on a mini website mockup.
Build an OKLCH Tint and Shade Scale Generator in a Single HTML File
A ready-to-paste prompt that builds an offline color tool turning one brand color into an even 50–900 OKLCH ramp with contrast badges and CSS or JSON token export.
Build a Button and Form Field States Reference Sheet in a Single HTML File
Get a polished, single-file reference sheet that shows button and text field states side by side, with a live playground and contrast ratios computed from design tokens.
Build a Light/Dark Mode Toggle Demo Page with Smooth Theme Switching
A single HTML page with a polished light/dark theme switch built on CSS custom properties that defaults to the system theme, honors reduced motion, and uses no storage.
- Build a Playful Animated 404 Error Page with SVG Art and Site Search
- Build a Responsive Navigation Bar With Mega Menu and Mobile Drawer in HTML
- Build a Responsive Three-Tier Pricing Section with Monthly/Yearly Toggle
- Build a Testimonial and Logo Social-Proof Section in a Single HTML File
- Build an Accessible Modal, Toast and Tooltip Showcase in One HTML File
- Build an SVG Line Icon Set Preview Sheet with Size and Stroke Controls