promptdojo_

The design kit — brand bible and design tokens as structured data — step 7 of 10

Before a kit is allowed to compile, its text colors have to clear the WCAG 2.1 AA contrast floor on the brand background — 4.5:1 for body text. This stopped being optional politeness: the European Accessibility Act has been enforceable since June 28, 2025, and WCAG is its technical baseline. Better your script catches the failure than the client's lawyer.

The starter gives you hex_to_rgb and luminance (the WCAG relative luminance formula, already implemented). Write contrast(h1, h2):

(lighter + 0.05) / (darker + 0.05)

where lighter/darker are the larger/smaller of the two luminances. The harness prints each text color against the background. Expected output:

terracotta on off-white: 3.95:1 FAIL
deep teal  on off-white: 5.23:1 PASS
goldenrod  on off-white: 1.78:1 FAIL
ink        on off-white: 14.29:1 PASS

Yes — terracotta, the hero color, fails for body text. Every brand has a color the client loves that can't legally set a paragraph. Now you have the receipt.

full-screen editor opens — close anytime to keep reading.