How to Inspect and Fix Colour Contrast Ratios Using the Colour Picker in Google Chrome DevTools

Ensuring adequate colour contrast between text and background elements is one of the foundational requirements of accessible web design. The Web Content Accessibility Guidelines (WCAG 2.1 and 2.2) mandate strict contrast thresholds: a minimum ratio of 4.5:1 for regular text and 3:1 for large text to satisfy Level AA conformance, or 7:1 and 4.5:1 respectively for Level AAA conformance. Insufficient contrast creates immediate usability barriers for users with low vision, colour vision deficiencies, or those viewing screens under bright outdoor sunlight.

Rather than relying on external web calculators or manual hex-code comparisons, Google Chrome DevTools includes a built-in contrast evaluator inside its native Colour Picker. When inspecting any styled text element, DevTools measures the effective foreground and background luminance, reports real-time contrast ratios, draws visual threshold guideline lines directly onto the colour spectrum, and even suggests compliant one-click colour adjustments. If you regularly refine web interfaces, you might also like our guides on emulating vision deficiencies in Chrome DevTools and inspecting CSS shadows in Chrome DevTools.

Inspecting Colour Contrast on Any Web Element

To inspect the contrast ratio of a specific heading, paragraph, or interface label in Google Chrome DevTools, follow these steps:

  1. Open Google Chrome and navigate to the webpage you wish to evaluate.
  2. Right-click the text element with questionable readability and select Inspect from the contextual menu (or press F12 / Option + Command + I).
  3. Ensure the Elements panel is selected at the top of DevTools.
  4. In the lower or adjacent Styles sub-pane, locate the CSS rule defining the text color property.
  5. Notice the small coloured square swatch rendered immediately to the left of the hex code or CSS colour value. Click this colour swatch to open the interactive Colour Picker popup.

Interpreting the Contrast Ratio Section

At the bottom of the Colour Picker dialogue, locate the Contrast ratio section. DevTools displays the calculated contrast score alongside WCAG compliance icons:

  • Numeric Ratio: Shows the exact mathematical contrast value (for example, 5.24).
  • Green Checkmarks: Two green checkmarks indicate that the current pairing satisfies both WCAG AA and AAA standards. A single checkmark indicates AA compliance only.
  • Red Prohibition Sign: Indicates that the combination fails minimum AA requirements (below 4.5:1 for normal body text).
  • Contrast Threshold Lines: Click the small expander arrow next to the Contrast ratio label. DevTools overlays two curved lines across the colour gradient box. The first line represents the Level AA threshold; moving the colour selector past the second line guarantees Level AAA compliance.

Fixing Inadequate Contrast with Suggested Accessible Colours

When an element fails accessibility criteria, Chrome DevTools provides automated recommendations to bring the palette into compliance without guessing alternative shades:

  1. With the Colour Picker open and the Contrast ratio section expanded, look below the calculated ratio.
  2. DevTools displays two circular colour swatches labeled AA and AAA. These represent the closest mathematical shades in your current hue that meet the required contrast thresholds.
  3. Click the AA swatch to instantly apply a compliant colour, or click the AAA swatch for maximum legibility.
  4. Observe how the live webpage immediately reflects the updated CSS colour. You can copy the newly generated hex code directly from the Styles panel into your stylesheet repository.

Resolving “No Contrast Information” Errors

Occasionally, DevTools displays an informational message stating that contrast cannot be calculated. This typically happens under the following conditions:

  • CSS Background Gradients or Images: If the text sits over a linear-gradient(), CSS background image, or video element, DevTools cannot compute a single uniform background luminance value. Use the Colour Picker’s Eyedropper tool to manually sample the darkest and lightest sections of the background.
  • Semi-Transparent Elements: When elements use CSS opacity or alpha channels (such as rgba() or hsla()), complex layer stacking may obstruct automatic calculation. Ensure parent container background colours are explicitly defined.
  • Positioned Overlays: Text overlaid via absolute positioning or complex z-index layering may require inspecting the parent stacking context in the Elements tree.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.