Button colour against its background

How the scan compares the main button fill with the colour right around it, the two distance limits for warn and fail, and how to make it stand out.

What AuditX checks

The scan picks the same main button as the check for a button that looks like a button, using the first screen at 1440 by 900 pixels (desktop) and 390 by 844 pixels (phone), phone first. It then reads the flat fill colour of that button from the page styles. It samples up to 8 points just outside the button box, 12 pixels away (above, below, left, right and the four corners). Points off the screen are skipped, and so are points covered by a separate fixed layer such as a cookie banner. For each point it goes through the elements stacked under that point, top first, and uses the first one that paints something. That is either a flat background colour, or a photo, video or background image, which counts as a point without a flat colour. It averages those colours and measures the perceptual distance between the button and the average (CIE76 delta-E in Lab colour space). It is not the same as the contrast ratio used for text. The check fails when the distance is below 15, which reads as almost the same colour. It warns from 15 up to 35, and passes at 35 or more. The result is an info note, which does not lower the score, when the page could not be measured, when no main button was found, when the button has no text label, when it has no solid fill (an outline or plain text button), when its fill is an image or a gradient, or when fewer than half of the sample points have a flat colour because the area around the button is a photo or a gradient. If the fill colour cannot be read, the result is an info note marked as not measured. The scan does not judge the label text, only the button against what surrounds it. A warn costs less than a fail.

Why it matters

Nielsen Norman Group notes that people spot clickable elements by their visual cues, and that similar-looking items compete when the button does not stand apart from what is around it.

W3C WCAG 1.4.11 (Non-text Contrast) asks that the visual information needed to identify a control has a 3:1 contrast ratio with the adjacent colours. This check uses a different measure, perceptual colour distance, so a pass here is not a WCAG result.

How to fix it

  1. Pick a button colour that differs clearly from the section it sits in, in lightness or in hue, and not only in its text colour.
  2. Test it by squinting at the page or viewing a greyscale screenshot. The button should still be the first thing you see.
  3. If the button sits on a photo or gradient, put it on a solid panel or add a solid border so it keeps its shape.
  4. When you change a section background, check again that the main button still stands out.
.hero { background: #f3f4f6; }
.hero .btn { background: #0b5fff; color: #ffffff; }

Does your site pass this check? A free scan runs it with every other check and shows the result in about a minute.

Scan my site

Sources

Related checks

Last reviewed 2026-11-13.