mirror of
https://github.com/bitbaum/causius.git
synced 2026-12-04 06:28:46 +01:00
One file, app/theme.css, now decides the whole look: light by default, a deep ink-indigo accent on warm paper, near-square corners, headlines set as capitals in the shared display serif. Display font, headline case/tracking/weight and action case are knobs there, so "more gothic" is a one-file edit. Dark follows the device or a header toggle, set before first paint by a nonce'd boot script. lib/theme.test.ts enforces WCAG AA for text, accent, on-accent label and status colours on every surface in both modes. Copy: the home page goes from about 980 words to about 240 (capabilities list and identity statement moved to /platform); the quick check, case page, helpers, platform and security pages were cut, in en/de/fr. lib/copy-budget.test.ts holds each page to a budget. Nav contract: language links, theme toggle and footer links are all at least 44x44; nothing overflows at 390/834/1440 in en/de/fr, light and dark. Claude-Session: https://claude.ai/code/session_01UzP8kyUAz5uhKE3mt87Yi7 Co-authored-by: Claude <noreply@anthropic.com>
10 lines
589 B
TypeScript
10 lines
589 B
TypeScript
/** Where the reader's light/dark choice is kept. */
|
|
export const THEME_KEY = "causius.theme";
|
|
|
|
/**
|
|
* Runs before the first paint, so a reader who prefers dark never sees a flash
|
|
* of light. The reader's own choice wins; without one, the device's does. It is
|
|
* an inline script, so it carries the response's CSP nonce (see the layout).
|
|
*/
|
|
export const THEME_BOOT = `(function(){try{var s=localStorage.getItem(${JSON.stringify(THEME_KEY)});var d=s?s==="dark":window.matchMedia("(prefers-color-scheme: dark)").matches;document.documentElement.classList.toggle("dark",d)}catch(e){}})()`;
|