A design token system has one job, which is to be the only place a colour is written down. PubTrivia has one, and it is clean: app/globals.css declares 25 tokens for the light theme and 24 each for the dark and forced-light themes, as 72 HSL triplets, with zero hex literals in the file .
.dark { --background : 0 0% 9% ; --foreground : 0 0% 98% ; --card : 0 0% 11% ; --muted-foreground : 0 0% 60% ; --border : 0 0% 18% ; ... }
Enter fullscreen mode
Exit fullscreen mode
Note the zeroes. The dark palette the public site actually renders in is pure neutral: hue 0, saturation 0, nothing but lightness.
Token Hex HSL Contrast on the background
background #171717 hsl(0, 0%, 9%) 1.00
card #1c1c1c hsl(0, 0%, 11%) 1.05
border #2e2e2e hsl(0, 0%, 18%) 1.32
muted-foreground #999999 hsl(0, 0%, 60%) 6.29
foreground #fafafa hsl(0, 0%, 98%) 17.18
Body text at 17.18:1 and secondary text at 6.29:1 is a comfortable pass of WCAG AA, with room to spare. So far so good.…