Lesson 5 of 8

Same Hex, Different Ground

Compare identical swatches on different backgrounds, then test the contrast of your own colour.

On this page

A blue-grey swatch can look lighter against charcoal than it does against frost. Both swatches below use the same hex. This is simultaneous contrast: surrounding colours affect how you see a colour.

Change either background, then select Join swatches. The two halves meet without a break in the fill. Try sand and teal with a grey swatch to see how different hues change the appearance of its edges.

Complements

Hues opposite each other on a colour wheel can make a strong pairing. Compare how that pairing draws your eye when it fills two equal areas and when one colour marks a single action on a tinted surface. In Triad mode, the two candidates sit 120° and 240° from the starting hue.

Pick in context

Enter a hex colour to preview it as text on five backgrounds. The ratio measures relative luminance. For WCAG AA, normal text needs at least 4.5:1 and large text needs at least 3:1.

If the colour falls short on one background, test a lighter or darker version for that surface. Give each version a role such as --text-on-light or --text-on-dark.

A quick checklist

  1. Choose a role. Decide whether the colour is for text, an action, a status, or a surface.
  2. Check the backgrounds you ship. Use the actual page, card or brand tint when measuring the pair.
  3. Adjust lightness in context. Try OKLCH when you want more even steps across hues.
  4. Check contrast and appearance. Use the ratio for text legibility and the side-by-side preview to judge how the colour reads.

Usage

Use the same custom property for each swatch to reproduce the comparison. The surrounding backgrounds are the only variable.

<div class="swatch-pair">
  <div class="ground ground--light"><span class="swatch"></span></div>
  <div class="ground ground--dark"><span class="swatch"></span></div>
</div>
.swatch-pair {
  --chip: #6B7C93;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
}

.ground {
  display: grid;
  place-items: center;
  min-height: 8rem;
}

.ground--light { background: #F4F5F7; }
.ground--dark { background: #141414; }

.swatch {
  width: 3rem;
  aspect-ratio: 1;
  background: var(--chip);
}