Knowing a color’s name does not tell you whether its text will be readable on a particular background. Start with two values: the color of the letters and the color directly behind them. Put both hex codes into a WCAG contrast checker. The result is a ratio, where larger numbers indicate greater difference in relative luminance.
Try a borderline pair on white
On a solid white background (#FFFFFF), gray #777777 produces a contrast ratio of about 4.48:1. For ordinary body text, that falls just below the WCAG 2.2 Level AA minimum of 4.5:1. A checker displaying only one decimal place may round the value to 4.5, so read its actual pass/fail result. Changing the text to #767676 raises the ratio to about 4.54:1. The small numerical change crosses the threshold for this pair.
For normal text, use 4.5:1 as the AA threshold. Qualifying large text has a 3:1 threshold. WCAG defines large text as at least 18 point, or 14 point if bold, with equivalent sizes for certain scripts. Do not classify text as large just because it looks prominent on a wide monitor. See W3C’s explanation of minimum text contrast.
Sample the background people actually see
- Read the intended text color and background from the design or browser inspector. Avoid sampling the gray antialiased edge of a letter.
- If the text or a background layer is partly transparent, determine the final displayed colors after blending.
- For a photo or gradient, check the weakest area directly behind the words. A pale strip behind just the last word can make it disappear.
- Repeat the check for buttons and links in their relevant interaction states. A normal label can pass while the same label on hover fails.
Fix the weaker part of the pair
For a gray caption on white, darken the lettering and retest. For white text on a busy photo, a solid panel behind the text can be more reliable than darkening the whole photograph. Keep the actual codes and the tested ratio in your design notes so another editor can reproduce the decision.
If you have only a descriptive name such as “slate”, first identify the exact hex value. The W3C testing technique describes where to measure and how the ratio is calculated.
