feat(theme): implement dual light/dark colour token system with WCAG AA contrast

Replace hard-coded hex values and ad-hoc `dark:` variants with a single
semantic token layer in `src/styles/global.css` (`@theme` + `html.dark`
re-declaration), so every component uses the same Tailwind class list in
both modes.

Key changes:
- Define semantic tokens (page, surface, ink, accent, edge, etc.) and raw
  ingredient palette (--color-spaghetti-*, --color-marinara*, etc.)
- Configure dual Shiki themes (light-plus / everforest-dark) with
  `defaultColor: false` for proper per-mode code block colours, replacing
  the old `.prose pre { #1f2937 !important }` hack
- Tint background particles to match the warm cream/espresso palette
  instead of pure black dots
- Document theme rules: add tokens not `dark:` variants, keep colour rules
  inside `@layer`, never target Tailwind utility classes with unlayered
  overrides, route prose colours through `--tw-prose-*` only

All text and interactive elements meet WCAG AA contrast (4.5:1 body, 3:1
large/interactive). Light mode is a warm cream plate with white cards; dark
mode is espresso (#140C08) with raised cards.
This commit is contained in:
spaghet committed 2026-11-12 20:48:10 -05:00
1 parent 8b6be36f7a
commit 9e157a4fa3
23 files changed
+544 -373

No files matched your search

+6 -2
View File
@@ -1,12 +1,16 @@
// Light-mode "particles" are grains of parmesan over the cream plate, not
// hard black dots: #000 at 1-2px reads as dirt and fights the pasta palette.
// Tinted with the ink token's hue and kept low-contrast on purpose.
function generateParticles(n) {
let value = `${getRandom(2560)}px ${getRandom(2560)}px #000`;
let value = `${getRandom(2560)}px ${getRandom(2560)}px #C9B49B`;
for (let i = 2; i <= n; i++) {
value += `, ${getRandom(2560)}px ${getRandom(2560)}px #000`;
value += `, ${getRandom(2560)}px ${getRandom(2560)}px #C9B49B`;
}
return value;
}
// Dark-mode stars: parmesan and cream over espresso (#140C08), not pure black.
function generateStars(n) {
let value = `${getRandom(2560)}px ${getRandom(2560)}px #FFF6E5`;
for (let i = 2; i <= n; i++) {