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

+19
View File
@@ -11,6 +11,25 @@ export default defineConfig({
integrations: [mdx(), sitemap(), solidJs()],
output: "server",
adapter: node({ mode: "ssr" }),
markdown: {
shikiConfig: {
// Two themes plus `defaultColor: false` makes Shiki emit every token as a
// `--shiki-light` / `--shiki-dark` pair instead of a hard-coded `color:`.
// global.css then picks one per mode, so a light-mode reader no longer
// gets a dark gray code block (the old `.prose pre { #1f2937 !important }`
// hack) and a dark-mode reader no longer gets cream-on-cream.
//
// Chosen by measuring every bundled theme's token colours against the
// site's own `code-bg` surfaces, not by eye: the previous vitesse pair
// bottomed out at 1.04:1 (light) and 1.28:1 (dark) — punctuation was
// effectively invisible. `light-plus` reaches ~3.5:1 on white and
// `everforest-dark` ~5.6:1 on the espresso block, and everforest's warm
// red/green/amber palette sits inside the pasta colours rather than
// fighting them.
themes: { light: "light-plus", dark: "everforest-dark" },
defaultColor: false,
},
},
vite: {
plugins: [tailwindcss()],
optimizeDeps: {