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
@@ -1,5 +1,5 @@
|
||||
{{define "navbar"}}
|
||||
<nav class="navbar navbar-dark navbar-expand">
|
||||
<nav class="navbar navbar-expand">
|
||||
<div class="container-fluid d-flex justify-content-between align-items-center">
|
||||
<div class="d-flex align-items-center">
|
||||
{{.NavbarBeforeBrand}}
|
||||
@@ -9,7 +9,18 @@
|
||||
</div>
|
||||
<div class="d-flex align-items-center gap-2">
|
||||
{{if .Username}}<span class="navbar-subtitle">{{.Username}}</span>{{end}}
|
||||
{{if .LogoutPath}}<form method="post" action="{{.BasePath}}{{.LogoutPath}}" class="d-inline m-0"><button type="submit" class="btn btn-outline-secondary btn-sm">Logout</button></form>{{end}}
|
||||
{{if .AppearancePath}}{{with .AppearanceMenu}}<details class="yw-appearance">
|
||||
<summary class="btn btn-outline-secondary btn-sm" title="{{.ThemeHeading}}: {{.Current.Label}}"><span aria-hidden="true">{{.Current.Symbol}}</span> {{.Current.Label}}</summary>
|
||||
<form method="post" action="{{$.BasePath}}{{$.AppearancePath}}" class="yw-appearance-menu m-0">
|
||||
<input type="hidden" name="back" value="{{$.AppearanceBack}}">
|
||||
<h6>{{.ThemeHeading}}</h6>
|
||||
{{range .Themes}}<button type="submit" name="theme" value="{{.ID}}" aria-pressed="{{.Current}}"><span aria-hidden="true">{{.Symbol}}</span> {{.Label}}</button>
|
||||
{{end}}<hr>
|
||||
<h6>{{.PaletteHeading}}</h6>
|
||||
{{range .Palettes}}<button type="submit" name="palette" value="{{.ID}}" aria-pressed="{{.Current}}">{{.Label}}</button>
|
||||
{{end}}</form>
|
||||
</details>
|
||||
{{end}}{{end}}{{if .LogoutPath}}<form method="post" action="{{.BasePath}}{{.LogoutPath}}" class="d-inline m-0"><button type="submit" class="btn btn-outline-secondary btn-sm">Logout</button></form>{{end}}
|
||||
{{.NavbarRightExtra}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user