Skip to main content
DrupalMaze
Free quote

USWDS color tokens and 508 contrast pairs in practice

The magic numbers behind USWDS colors

USWDS grades every color on a 5–90 scale. The rule that matters for accessibility: a grade difference of 50 or more between foreground and background passes WCAG AA contrast for normal text, and 40 passes for large text and icons. gray-90 text on a gray-5 background is a difference of 85 — comfortably AAA. blue-50v on white is exactly 50 — AA-passing, no margin to spare.

Why token grades beat hex math

You could compute contrast ratios per hex value, but the grade system encodes the answer directly. When a designer hands you primary-lighter behind primary-dark text, you can check the pair in seconds instead of running a contrast tool on every combination. The system makes the accessible choice the easy choice.

Pairs that pass, pairs that trap you

The pairings that reliably work: ink or gray-90 on any grade 10 or lighter; white on grade 50 or darker; base-lighter (grade 10) under base-darkest (90). The traps: the vivid grades — red-50v, blue-50v — pass on white but fail on gray-5, and grade-40 mid-tones fail against both white and black. When in doubt, widen the gap.

Enforcing it in a Drupal theme

Set theme tokens once and let components inherit:

@use "uswds-core" with (
  $theme-color-base-ink: "gray-90",
  $theme-color-primary: "blue-60v",
  $theme-color-primary-dark: "blue-70v"
);

Then forbid raw hex values in code review. Every literal color is a contrast decision nobody checked.

Grades are not a guarantee

The 50-point rule assumes solid fills at normal sizes. Anti-aliasing on thin fonts, text over images, and disabled-state transparency all degrade real-world contrast. Treat 50 as the floor: aim for 60+ on body text, and always spot-check rendered pages — automated grading does not see your font weight.

Auditing a theme against 508? Our Drupal services include full color-system reviews.

Bring us your beautifully complicated problem.

↗