Check the contrast of store button text against WCAG
Measure text contrast in each button state and hand off the chosen colors with their ratios.
The problem
A white Add to cart label sits on a light orange button. It looks legible on your design monitor and fades on a dimmer phone. Record the actual color pair in each state so the visual judgment has a measurable check.
The tool
WCAG 2.2 Level AA sets a contrast minimum of 4.5:1 for ordinary text and 3:1 for text that meets its definition of large. Apply that criterion to the button label and record the result with the design.
The steps
- Capture the text color and the background directly underneath. Compare design values with computed browser values, especially if a layer is translucent.
- List the default, hover and keyboard focus states. For each, record the button name, text color and background color.
- Enter each color pair in a contrast checker. As a reference, white
#FFFFFFover gray#767676is about 4.54:1. With#777777it is about 4.48:1. - Compare the unrounded ratio with the correct minimum. A result of 4.48:1 misses 4.5:1 even if a tool displays fewer decimal places.
- Adjust one color and recheck all affected states. If your site uses dark mode, check the dark color pairs separately.
- Send the developer the color values, state names and ratios. Once implemented, use the keyboard to reach the button and confirm that the label remains legible.
The real cost
The specification is freely available and a free checker is enough for a solid color pair. Early review helps keep implementation revisions down.
The free alternative
Use the browser's built-in developer tool if it reports the computed contrast for the element. Gradients and photos still need a check at the spot where the label sits.
Notes
- We have not tried these steps ourselves yet. They are based on the official docs. Button names may change. If your interface differs, follow the docs.
- Avoid rounding a failing value up to the threshold.
- Text contrast is one check. The control boundary and focus indicator have their own considerations.
Sources
Did you like this guide?
The weekly newsletter is being prepared. Leave your email and we'll send it when it launches.
We use your email only to send the newsletter. Privacy policy
