Palettes, light-dark() tokens, Bootstrap bridge and a theme menu
Every color token is now one light-dark(<light>, <dark>) pair; the mode (data-theme) only sets color-scheme, so "system" no longer needs a duplicated media-query block. RGB triplets and the url() icons Bootstrap swaps in dark mode pick their value via the --yw-if-light/--yw-if-dark switches. Bootstrap's theme-dependent --bs-* variables and the components that hard-code its primary blue are mapped onto --yw-*, so tables, forms, links, buttons and alerts follow the theme. The navbar drops navbar-dark, which pinned its colors to white in light mode. New data-palette axis (PageHeader.Palette): default, graphite (grey/violet, after nessajina.tv) and contrast. The default palette keeps the #0b82b8 nav-link token; the others use their own. appearance.go: ApplyAppearance reads the yw_theme/yw_palette cookies, AppearanceHandler stores a choice (POST only, local redirects only), and PageHeader.AppearancePath shows a script-free <details> menu in the navbar. TestPaletteTokens replaces TestThemeBlocksInSync. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d0e49b2365
commit
3af449e9f9
8 files changed
+893
-179
No files matched your search
@@ -29,7 +29,7 @@ var staticFS embed.FS
|
||||
// base/navbar/sidebar/footer templates.
|
||||
const LayoutGlob = "templates/layout/*.tmpl"
|
||||
|
||||
// Values for PageHeader.Theme; each has its own block in static/style.css.
|
||||
// Values for PageHeader.Theme, the color mode; see static/style.css.
|
||||
const (
|
||||
ThemeDark = "dark"
|
||||
ThemeLight = "light"
|
||||
@@ -59,13 +59,22 @@ type PageHeader struct {
|
||||
// execution time, not at parse time.
|
||||
AppName string
|
||||
Lang string // <html lang="...">; "" defaults to "en"
|
||||
// Theme selects which --yw-* token block static/style.css applies,
|
||||
// rendered as <html data-theme="...">: ThemeDark, ThemeLight or
|
||||
// ThemeSystem (follows prefers-color-scheme). "" omits the attribute,
|
||||
// which resolves to the bare :root values (dark), so a consumer that
|
||||
// never sets Theme keeps its look. Persisting a user's choice is the
|
||||
// consumer's concern (see README.md's Theming section).
|
||||
Theme string
|
||||
// Theme is the color mode, rendered as <html data-theme="...">:
|
||||
// ThemeDark, ThemeLight or ThemeSystem (follows
|
||||
// prefers-color-scheme). "" omits the attribute, which is dark, so a
|
||||
// consumer that never sets Theme keeps its look.
|
||||
Theme string
|
||||
// Palette is the color set, rendered as <html data-palette="...">:
|
||||
// PaletteDefault, PaletteGraphite or PaletteContrast; "" is
|
||||
// PaletteDefault. ApplyAppearance fills Theme and Palette from the
|
||||
// visitor's cookies (see README.md's Theming section).
|
||||
Palette string
|
||||
// AppearancePath is the BasePath-relative POST route of
|
||||
// AppearanceHandler, e.g. "/appearance"; set, the navbar shows the
|
||||
// theme/palette menu. AppearanceBack is the BasePath-relative page
|
||||
// the menu returns to (ApplyAppearance sets it).
|
||||
AppearancePath string
|
||||
AppearanceBack string
|
||||
Brand string // navbar brand text, e.g. "YASTA"
|
||||
BrandInitial string // single-letter favicon glyph, e.g. "y"
|
||||
Subtitle string
|
||||
|
||||
Reference in new issue
Block a user