Files
Spaghet.io/astro.config.mjs
T
spaghet 9e157a4fa3 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.
2026-11-12 20:48:10 -05:00

48 lines
2.2 KiB
JavaScript

import { defineConfig } from "astro/config"
import mdx from "@astrojs/mdx"
import sitemap from "@astrojs/sitemap"
import solidJs from "@astrojs/solid-js"
import node from "@astrojs/node"
import tailwindcss from "@tailwindcss/vite"
// https://astro.build/config
export default defineConfig({
site: "https://spaghet.io",
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: {
// Client-island deps that are not reachable from the SSR entry graph are
// discovered mid-session, which makes Vite re-optimize and bump the browserHash.
// Every already-served island module then 504s with "Outdated Optimize Dep",
// hydration aborts, and the Solid lists on /blog, /projects and /search stay
// empty. Pre-declaring them bundles them at startup so the hash never changes
// underneath a page. Keep this list in sync with the imports of every
// src/components/*.tsx island (solid-js, @lib/utils -> clsx + tailwind-merge,
// @lib/search -> fuse.js).
include: ["solid-js", "solid-js/web", "clsx", "tailwind-merge", "fuse.js"],
},
}
})