Skip to content
IndexRequest a UIAboutContact

Palette Contrast Matrix

Test every colour in a five-colour palette against every other at once and see which pairs are safe for text.

Open alone ↗

AI prompt

PROMPT: PASTE INTO YOUR AI IMAGE OR VIDEO TOOL
Design documentation sheet showing a five-colour palette as a five by five contrast matrix: colour names along the top and left, each cell filled with the background colour and showing a bold Aa in the text colour with the ratio such as 7.3 beneath, small green ticks for pairs above 4.5 and grey dashes for failing pairs, clean grid with thin gutters, flat vector style, plenty of white space. Negative: gradients, shadows, text errors, decorative frames. Reduced motion: static sheet.

About this pattern

Definition

A palette is only useful if its colours can sit on each other. A contrast matrix puts every colour as text against every colour as background, with the ratio and a pass mark in each cell, so you can see at a glance which pairs are safe for body text, large text or neither.

When to use it

  • Run the matrix before committing to a palette, not after the design is built.
  • Mark pairs by what they can do: 4.5 or more for body text, 3 or more for large text and icons, below 3 for decoration only.
  • Fix a failing pair by moving one colour lighter or darker, not by adding an outline.

What the controls do

  • Three palettes; each cell shows the ratio and a pass, large-only or fail mark.

Motion & timing

  • Updates are instant; no animation.
  • Reduced motion: nothing to change.

Tips & variations

  • Include the real background and surface colours the interface will use.
  • Check dark mode as a second palette.

Code of this live preview

HTML
<div class="bx"><div class="pre" id="pre" role="group" aria-label="Palette"><button data-p="0" aria-pressed="true">Ink & Sand</button><button data-p="1" aria-pressed="false">Ocean</button><button data-p="2" aria-pressed="false">Forest</button></div><div class="mx" id="mx" role="table" aria-label="Contrast matrix"></div><p class="out">Rows are text colours, columns are backgrounds.</p></div>

Related patterns

Contrast Ratio Checker

↗
Contrast Ratio CheckerColour Techniques

Semantic Colour Roles

↗
Semantic Colour RolesPalettes by Concept

Tint, Shade & Tone Ramps

↗
Tint, Shade & Tone RampsColour Techniques