Prepare theming: PageHeader.Theme -> <html data-theme>, explicit dark block

Zero behavior change for every current consumer (Theme defaults to "",
which resolves to the unchanged bare :root block). Adds the seam a
future second theme slots into: its own :root[data-theme="..."] block
in static/style.css, nothing else in this module changes. See
README.md's expanded Theming section for the concrete mechanism.
This commit is contained in:
terminar committed 2026-09-01 22:24:58 +02:00
1 parent adea139888
commit 8875062fc5
5 files changed
+123 -34

No files matched your search

+46 -14
View File
@@ -1,18 +1,21 @@
/* Shared web UI chrome -- the dark-theme base layout, navbar, sidebar, and
footer used by every ops-tool dashboard built on this module (yasta,
yasl, yaiam, yakwui, yamase-web, yamocir). Loaded after
bootstrap.min.css. Page-content styling (cards, tables, badges,
forms, ...) is each project's own concern and lives in that project's
own stylesheet, loaded alongside this one -- see
PageHeader.ExtraHeadHTML. Fixed dark theme only -- no
prefers-color-scheme, no light mode (see README.md's Theming section
before assuming that's a gap to fill here).
/* Shared web UI chrome -- the base layout, navbar, sidebar, and footer
used by every ops-tool dashboard built on this module (yasta, yasl,
yaiam, yakwui, yamase-web, yamocir). Loaded after bootstrap.min.css.
Page-content styling (cards, tables, badges, forms, ...) is each
project's own concern and lives in that project's own stylesheet,
loaded alongside this one -- see PageHeader.ExtraHeadHTML.
The palette below is exposed as --yw-* custom properties, not just
baked into each rule -- it's the shared "theme" every migrated
project inherits, not an implementation detail. A project needing a
genuinely different look (not just a different accent) should not
redefine these globally -- see README.md. */
The palette is exposed as --yw-* custom properties, not baked into
each rule -- a documented, reusable theme, not an implementation
detail. Exactly one theme ships today ("dark"); PageHeader.Theme
(see layout.go) renders as <html data-theme="...">, which is the seam
a second theme slots into: add its own :root[data-theme="..."] block
below with the same property list, new values -- nothing else in this
module changes, and unset Theme (every current consumer) keeps
resolving to the bare :root block, i.e. today's exact look. A project
needing a genuinely different look (not just a different accent)
should not redefine these globally -- see README.md's Theming
section. */
:root {
--yw-bg: #1a1d23;
@@ -39,6 +42,35 @@
--bs-border-color: var(--yw-border);
}
/* Theme: "dark" -- explicit opt-in via PageHeader.Theme = "dark",
byte-identical to the bare :root block above (which is what unset
Theme resolves to). Kept in sync manually -- there are only ever a
handful of themes here, a preprocessor would be overkill. */
:root[data-theme="dark"] {
--yw-bg: #1a1d23;
--yw-text: #d4d8e0;
--yw-border: #333;
--yw-chrome-bg: #14171e;
--yw-chrome-border: #272d3a;
--yw-accent: #4fc3f7;
--yw-accent-rgb: 79, 195, 247;
--yw-nav-link: #0b82b8;
--yw-nav-link-hover-text: #c8d4e4;
--yw-subtitle: #5a7a9a;
--yw-subtitle-sep: #333c4a;
--yw-footer-text: #4a5a72;
--yw-success-bg: #192e22;
--yw-success-border: #2a5c3a;
--yw-success-text: #7ecf98;
--yw-danger-bg: #2e1820;
--yw-danger-border: #5c2a32;
--yw-danger-text: #e08090;
--bs-body-bg: var(--yw-bg);
--bs-body-color: var(--yw-text);
--bs-border-color: var(--yw-border);
}
html {
height: 100%;
}