From 8232c6a1d455ad4724665e663796a96ec51b1eaf Mon Sep 17 00:00:00 2001 From: Locust agent Date: Mon, 2 Nov 2026 21:15:32 +0000 Subject: [PATCH] feat(tokens): add light and dark colour tokens Define the nine contract custom properties in public/src/main.css, with light values in the :root block and dark values in the .dark block that the theme helper applies to the root element. Every pair was measured against the WCAG 2.2 minimums and clears them with headroom in both themes: body and muted text at 4.5:1, large text and the border (which doubles as the UI component boundary) at 3:1, and accent used as text at 4.5:1. Borders are checked on both the background and the muted surface. Import the file from public/src/main.js after the legacy sheet import, so the tokens are in the bundle and are the last definition of any name the legacy sheet also sets. --- public/src/main.css | 50 +++++++++++++++++++++++++++++++++++++++++++++ public/src/main.js | 1 + 2 files changed, 51 insertions(+) create mode 100644 public/src/main.css diff --git a/public/src/main.css b/public/src/main.css new file mode 100644 index 0000000..3feeec6 --- /dev/null +++ b/public/src/main.css @@ -0,0 +1,50 @@ +/** + * Colour tokens for the BEAT site. + * + * The nine names below are the contract that every component and every + * Tailwind colour mapping reads from. Define them once here and keep the + * names stable: a rename is a breaking change for the whole site. + * + * --color-background + * --color-foreground + * --color-muted + * --color-muted-foreground + * --color-border + * --color-accent + * --color-accent-foreground + * --color-text-body + * --color-text-large + * + * Light values live in :root. Dark values live in the .dark block, which the + * theme helper applies to the root element, so a theme change flips every + * token in one step. + * + * Every pair below was measured against the WCAG 2.2 minimums with headroom: + * body and muted text at 4.5:1, large text and borders at 3:1, and accent + * text at 4.5:1. Borders are checked against both the background and the + * muted surface, because a border is often drawn on the muted surface. + */ + +:root { + --color-background: #ffffff; + --color-foreground: #111827; + --color-muted: #f1f5f9; + --color-muted-foreground: #475569; + --color-border: #64748b; + --color-accent: #1d4ed8; + --color-accent-foreground: #ffffff; + --color-text-body: #374151; + --color-text-large: #1f2937; +} + +.dark { + --color-background: #0f172a; + --color-foreground: #f8fafc; + --color-muted: #1e293b; + --color-muted-foreground: #94a3b8; + --color-border: #7c8ca3; + --color-accent: #60a5fa; + --color-accent-foreground: #0f172a; + --color-text-body: #cbd5e1; + --color-text-large: #e2e8f0; +} diff --git a/public/src/main.js b/public/src/main.js index 2f10b40..5ebe33d 100644 --- a/public/src/main.js +++ b/public/src/main.js @@ -3,6 +3,7 @@ import App from './App.vue' import router from './router' import { initializeTheme } from './components/theme/theme' import './assets/styles/main.css' +import './main.css' // The theme is applied before the app mounts, so a cold load never paints the // wrong theme first.