diff --git a/README.md b/README.md index 49e5c65..2684b03 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,43 @@ Optional environment variables (all have working defaults): | `STATUS_STALE_AFTER_SECONDS` | `900` | Treat the light as unknown once beats stop arriving | +## Theme and Colour Tokens + +The site has one colour system, in `src/styles/global.css`. Components never hard-code +a hex and, in almost every case, never need a `dark:` colour variant. + +- **`@theme`** declares semantic tokens (`page`, `surface`, `wash`, `ink`, `ink-muted`, + `accent`, `link`, `link-hover`, `edge`, `line`, `chip`, `chip-ink`, `code-bg`, `focus`, + `status-*`). Tailwind generates `bg-page`, `text-ink`, `border-edge`, … from them. +- **`html.dark`** re-declares the same names with cooked-longer values. Because Tailwind + emits the utilities as `var(--color-*)` references, flipping the class on `` + recolours the whole site from the same class list. +- **`--color-spaghetti-*`, `--color-marinara*`, `--color-meatball*`, `--color-parmesan`** + are the raw ingredient palette. They feed the hero sky and gradients; they are *not* + for text, because the pastels fall to 1.1–1.5:1 on the cream plate. + +Rules that keep it from drifting again: + +1. Add a token, don't add a `dark:` variant. A component class list should read the same + in both modes. +2. Keep colour rules inside `@layer`. Unlayered CSS outranks every Tailwind layer, which + is how `.dark .text-spaghetti-brown` used to silently beat `dark:` utilities and put + cream-on-cream text on the hero button (1.18:1). +3. Never target a Tailwind utility class (e.g. `.border-black/15`) with an unlayered + override — it fires in both modes. +4. Prose colours go through `--tw-prose-*` only. The `html .prose` prefix in `global.css` + is load-bearing: the typography plugin emits its defaults into the same layer but + later, so at equal specificity it would win and articles would render slate. + +Contrast is held to WCAG AA: 4.5:1 for body text and links, 3:1 for large text and +interactive borders. Light mode is a warm cream plate with white cards; dark mode is a +warm espresso plate (`#140C08`) with raised cards, so the marinara-and-meatball night sky +has something warm to sit on. + +Code blocks use dual Shiki themes (`light-plus` / `everforest-dark`, chosen by measuring +every bundled theme's tokens against the site's own code backgrounds) with the +`--shiki-light` / `--shiki-dark` swap in `global.css`. + ## Technologies Used - **Framework**: Astro (Static site generation) diff --git a/astro.config.mjs b/astro.config.mjs index c5416ec..be148b1 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -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: { diff --git a/public/js/bg.js b/public/js/bg.js index 1978c91..db22be3 100644 --- a/public/js/bg.js +++ b/public/js/bg.js @@ -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++) { diff --git a/public/ui.svg b/public/ui.svg index 72bcdf6..2ab1a89 100644 --- a/public/ui.svg +++ b/public/ui.svg @@ -82,6 +82,13 @@ + + + + + + + diff --git a/src/components/ArrowCard.tsx b/src/components/ArrowCard.tsx index 4cfb78a..deb57fb 100644 --- a/src/components/ArrowCard.tsx +++ b/src/components/ArrowCard.tsx @@ -13,34 +13,34 @@ export default function ArrowCard({entry, pill, collection}: Props) { const resolvedCollection = "collection" in entry ? entry.collection : collection const id = "slug" in entry ? entry.slug : entry.id return ( - -
+ +