mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-19 22:46:20 -05:00
Every color now resolves through CSS custom properties on html[data-theme=...], so a theme is a table of values rather than code. Four themes ship: light, dark, night (red hues only, to preserve dark adaptation off-grid) and amber (monochrome amber terminal). Fonts are exposed as two roles, --font-body and --font-mono, which a theme assigns a bundled face to; amber uses the mono face. Faces must be self-hosted, never fetched from a CDN, so the app keeps working offline. Night mode also filters media that cannot consume tokens - video, images, PDFs, embedded pages, canvases - through an SVG color matrix that maps luminance onto the red channel. Tag such an element with `.media`; a filter on an app-level ancestor would create a containing block and break fixed positioning. ThemeProvider persists the choice and index.html stamps data-theme from localStorage before the bundle loads, so the first paint already matches the saved theme on a slow connection. The OS preference is followed only while "system" is selected; night and amber are explicit choices. The nav toggle becomes a five-item picker. Semantic components still render themselves, so only the shell is token-driven for now; the inverted props stay in place until each component is migrated. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
25 lines
1,014 B
CSS
25 lines
1,014 B
CSS
/*
|
|
* Bundled font registry.
|
|
*
|
|
* Fonts are exposed to themes as ROLES (--font-body, --font-mono), never as
|
|
* families. A theme assigns one of the bundled `--font-<name>` stacks to a
|
|
* role; it may not name an arbitrary family, because a theme config file
|
|
* cannot ship font files and an unknown family would silently fall back —
|
|
* offline, with no error.
|
|
*
|
|
* Every face here must be available offline. The system stacks cost nothing.
|
|
* Additional faces are added as `@fontsource/*` npm packages (woff2 bundled at
|
|
* build time) — NEVER a fonts CDN <link>.
|
|
*/
|
|
|
|
:root {
|
|
/* Available faces. */
|
|
--font-system-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue',
|
|
Arial, 'Noto Sans', sans-serif;
|
|
--font-system-mono: 'SF Mono', 'Cascadia Code', 'DejaVu Sans Mono', Menlo, Monaco, Consolas,
|
|
'Liberation Mono', monospace;
|
|
|
|
/* Role assignments. Themes override these. */
|
|
--font-body: var(--font-system-sans);
|
|
--font-mono: var(--font-system-mono);
|
|
}
|