Modern style as the new default; style axis, slate palette, nav groups and icons

A third appearance axis, PageHeader.Style (<html data-style>), with
StyleModern -- the default when Style is empty -- and StyleClassic, the
look up to v0.4.x. The modern style is one [data-style="modern"] block
at the end of style.css over the classic rules: navbar without a rule,
the sidebar as a floating rounded card with group headings, icons and
a pill for the active entry, rounder and quieter Bootstrap components.
In it inactive sidebar links use the text color; #0b82b8 now only
colors them in the classic style (owner decision 2026-11-28).

- appearance menu: "Style"/"Stil" section, cookie yw_style
- palette slate (dark slate and lavender)
- NavItem.Group (sidebar group headings) and NavItem.Icon (names from
  the new NavIcons set, shown only in the modern style)
- cmd/webui-demo: a sample page for comparing styles, palettes and modes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
terminarandClaude Opus 5.5 committed 2026-11-28 11:11:28 +01:00
1 parent 7afb6a022a
commit 33dfebab9e
13 files changed
+771 -28

No files matched your search

+343 -1
View File
@@ -12,7 +12,11 @@
dark, the look every consumer had before themes existed. The mode
only sets color-scheme and the --yw-if-* switches below.
- data-palette (PageHeader.Palette): the colors -- "default",
"graphite" or "contrast". Unset is "default".
"graphite", "contrast" or "slate". Unset is "default".
- data-style (PageHeader.Style): the shape -- "modern" (the
default; the template always sets the attribute) or "classic".
The rules without a data-style selector are the classic look;
the modern section at the end of this file overrides them.
Every color token is written once, as light-dark(<light>, <dark>), so
a palette is one block and no mode duplicates another's values. The
@@ -181,6 +185,44 @@
--yw-info-text: light-dark(#003f5c, #a0dcff);
}
/* slate: dark slate blue-grey with a soft lavender accent, made to go
with data-style="modern" (but works with either style). The primary
is light enough in dark mode that buttons carry dark text. */
:root[data-palette="slate"] {
--yw-bg: light-dark(#f5f5fa, #11131a);
--yw-bg-rgb: var(--yw-if-light, 245, 245, 250) var(--yw-if-dark, 17, 19, 26);
--yw-surface: light-dark(#ffffff, #1a1d27);
--yw-surface-rgb: var(--yw-if-light, 255, 255, 255) var(--yw-if-dark, 26, 29, 39);
--yw-surface-2: light-dark(#ececf4, #222634);
--yw-surface-2-rgb: var(--yw-if-light, 236, 236, 244) var(--yw-if-dark, 34, 38, 52);
--yw-text: light-dark(#23242e, #d5d8e2);
--yw-text-rgb: var(--yw-if-light, 35, 36, 46) var(--yw-if-dark, 213, 216, 226);
--yw-text-strong: light-dark(#0d0e14, #f4f5f9);
--yw-text-strong-rgb: var(--yw-if-light, 13, 14, 20) var(--yw-if-dark, 244, 245, 249);
--yw-muted: light-dark(#626679, #9095a8);
--yw-border: light-dark(#d9dae6, #2e3345);
--yw-chrome-bg: light-dark(#f5f5fa, #11131a);
--yw-chrome-border: light-dark(#e2e3ec, #262a39);
--yw-brand: light-dark(#1d1b2e, #f4f5f9);
--yw-accent: light-dark(#5b45c9, #b4a2ff);
--yw-accent-rgb: var(--yw-if-light, 91, 69, 201) var(--yw-if-dark, 180, 162, 255);
--yw-link: light-dark(#5b45c9, #b4a2ff);
--yw-link-rgb: var(--yw-if-light, 91, 69, 201) var(--yw-if-dark, 180, 162, 255);
--yw-link-hover: light-dark(#4632a8, #cfc3ff);
--yw-link-hover-rgb: var(--yw-if-light, 70, 50, 168) var(--yw-if-dark, 207, 195, 255);
--yw-primary: light-dark(#5b45c9, #b9a8ff);
--yw-primary-rgb: var(--yw-if-light, 91, 69, 201) var(--yw-if-dark, 185, 168, 255);
--yw-on-primary: light-dark(#ffffff, #19142e);
--yw-nav-link: light-dark(#3a3d4d, #c3c6d3);
--yw-nav-link-hover-text: light-dark(#1d1b2e, #ffffff);
--yw-subtitle: light-dark(#626679, #9095a8);
--yw-subtitle-sep: light-dark(#cfd0dc, #2e3345);
--yw-footer-text: light-dark(#7a7e90, #646a7e);
--yw-info-bg: light-dark(#eeebfb, #1f1c33);
--yw-info-border: light-dark(#cdc4f1, #3d3566);
--yw-info-text: light-dark(#463399, #cfc3ff);
}
/* --- Bootstrap bridge --------------------------------------------- */
/* Bootstrap's theme-dependent variables, taken from the palette. This
@@ -582,3 +624,303 @@ body.no-sidebar main {
align-content: flex-start;
}
}
/* --- Style: modern (data-style="modern", PageHeader.Style) ---------- */
/* The default design since v0.5.0, over the same markup and the same
palettes: a calm navbar without a rule, the sidebar as a
floating rounded card with group headings and icons, a pill for the
active entry, and softer, rounder Bootstrap components. Everything
here is scoped to [data-style="modern"], so data-style="classic"
still gives exactly the classic look above. Icons and group headings come from
NavItem.Icon/Group; classic hides the icons. */
.yw-nav-icon {
display: none;
}
.yw-nav-group {
color: var(--yw-muted);
font-size: .68rem;
font-weight: 600;
letter-spacing: .09em;
text-transform: uppercase;
padding: .9rem 1rem .3rem;
}
[data-style="modern"] {
--yw-radius: .75rem;
--yw-radius-sm: .5rem;
--bs-border-radius: var(--yw-radius-sm);
--bs-border-radius-sm: .375rem;
--bs-border-radius-lg: var(--yw-radius);
--bs-border-radius-xl: 1rem;
--bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
[data-style="modern"] body {
font-size: .9rem;
-webkit-font-smoothing: antialiased;
}
[data-style="modern"] h1,
[data-style="modern"] h2,
[data-style="modern"] h3 {
color: var(--yw-text-strong);
font-weight: 700;
letter-spacing: -.02em;
}
/* Navbar: same surface as the page, no rule; the brand reads as a
product name, not a code. */
[data-style="modern"] .navbar {
background: var(--yw-bg) !important;
border-bottom: 0;
padding: .9rem 1.5rem;
}
[data-style="modern"] .navbar-brand {
color: var(--yw-text-strong) !important;
font-size: 1.1rem;
font-weight: 700;
letter-spacing: -.01em;
}
[data-style="modern"] .navbar-subtitle-sep {
display: none;
}
[data-style="modern"] .navbar .btn-sm,
[data-style="modern"] .yw-user {
border-radius: var(--yw-radius-sm);
padding: .35rem .8rem;
}
[data-style="modern"] .navbar .btn-outline-secondary {
--bs-btn-color: var(--yw-text);
--bs-btn-border-color: var(--yw-border);
--bs-btn-hover-color: var(--yw-text-strong);
--bs-btn-hover-bg: var(--yw-surface-2);
--bs-btn-hover-border-color: var(--yw-border);
--bs-btn-active-color: var(--yw-text-strong);
--bs-btn-active-bg: var(--yw-surface-2);
--bs-btn-active-border-color: var(--yw-border);
}
[data-style="modern"] .yw-user {
color: var(--yw-text);
background: var(--yw-surface);
border: 1px solid var(--yw-border);
}
[data-style="modern"] .yw-appearance-menu {
background: var(--yw-surface);
border-color: var(--yw-border);
border-radius: var(--yw-radius);
padding: .4rem;
box-shadow: 0 .75rem 2rem rgba(0, 0, 0, .3);
}
[data-style="modern"] .yw-appearance-menu h6 {
margin: .4rem .6rem .2rem;
}
[data-style="modern"] .yw-appearance-menu button {
border-radius: var(--yw-radius-sm);
padding: .35rem .6rem;
}
[data-style="modern"] .yw-appearance-menu button[aria-pressed="true"] {
background: color-mix(in srgb, var(--yw-accent) 16%, transparent);
}
/* Sidebar: no full-height column any more, but a card that floats
in the column and stays in view while the page scrolls. */
[data-style="modern"] .sidebar {
background: transparent;
border-right: 0;
padding: .5rem .25rem 1rem 1rem;
}
[data-style="modern"] .sidebar > .nav {
position: sticky;
top: 1rem;
background: var(--yw-surface);
border: 1px solid var(--yw-border);
border-radius: var(--yw-radius);
padding: .5rem !important;
gap: 1px;
}
[data-style="modern"] .yw-nav-group {
padding: .8rem .65rem .3rem;
}
[data-style="modern"] .yw-nav-group:first-child {
padding-top: .35rem;
}
[data-style="modern"] .sidebar .nav-link {
display: flex;
align-items: center;
gap: .6rem;
color: var(--yw-text);
font-size: .875rem;
padding: .45rem .65rem;
border-radius: var(--yw-radius-sm);
border-left: 0;
}
[data-style="modern"] .yw-nav-icon {
display: inline-flex;
flex: none;
color: var(--yw-muted);
}
[data-style="modern"] .sidebar .nav-link:hover {
background: var(--yw-surface-2);
color: var(--yw-text-strong);
}
[data-style="modern"] .sidebar .nav-link.active {
background: color-mix(in srgb, var(--yw-accent) 18%, var(--yw-surface));
color: var(--yw-accent);
font-weight: 600;
border-left: 0;
}
[data-style="modern"] .sidebar .nav-link.active .yw-nav-icon {
color: inherit;
}
[data-style="modern"] main {
padding-top: 1.25rem !important;
padding-bottom: 2rem !important;
}
[data-style="modern"] .footer {
border-top: 0;
color: var(--yw-muted);
opacity: .75;
}
/* Bootstrap components the consumers' pages use: rounder, quieter,
cards on the surface color with a hairline border. */
[data-style="modern"] .card {
--bs-card-bg: var(--yw-surface);
--bs-card-border-color: var(--yw-border);
--bs-card-border-radius: var(--yw-radius);
--bs-card-inner-border-radius: calc(var(--yw-radius) - 1px);
--bs-card-cap-bg: transparent;
box-shadow: none;
}
[data-style="modern"] .card-header {
font-weight: 600;
color: var(--yw-text-strong);
}
[data-style="modern"] .list-group {
--bs-list-group-bg: var(--yw-surface);
--bs-list-group-border-color: var(--yw-border);
--bs-list-group-border-radius: var(--yw-radius);
--bs-list-group-action-hover-bg: var(--yw-surface-2);
}
[data-style="modern"] .btn {
--bs-btn-font-weight: 600;
--bs-btn-padding-x: 1rem;
--bs-btn-border-radius: var(--yw-radius-sm);
}
[data-style="modern"] .btn-sm {
--bs-btn-padding-x: .7rem;
}
[data-style="modern"] .form-control,
[data-style="modern"] .form-select {
background-color: color-mix(in srgb, var(--yw-bg) 60%, var(--yw-surface));
border-color: var(--yw-border);
border-radius: var(--yw-radius-sm);
padding-top: .5rem;
padding-bottom: .5rem;
}
[data-style="modern"] .form-label {
font-weight: 600;
color: var(--yw-text-strong);
}
[data-style="modern"] .table {
--bs-table-bg: transparent;
--bs-table-border-color: var(--yw-border);
}
[data-style="modern"] .table > thead th {
color: var(--yw-muted);
font-size: .72rem;
font-weight: 600;
letter-spacing: .06em;
text-transform: uppercase;
}
[data-style="modern"] a:not(.btn):not(.nav-link):not(.navbar-brand):not(.list-group-item) {
text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
text-underline-offset: .2em;
}
[data-style="modern"] a:not(.btn):not(.nav-link):not(.navbar-brand):not(.list-group-item):hover {
text-decoration-color: currentColor;
}
/* A table as the whole body of a card: the card draws the outline. */
[data-style="modern"] .card > .table:last-child > tbody > tr:last-child > * {
border-bottom-width: 0;
}
/* Status badges as quiet tinted chips instead of solid blocks. */
[data-style="modern"] .badge.text-bg-success { background: var(--yw-success-bg) !important; color: var(--yw-success-text) !important; box-shadow: inset 0 0 0 1px var(--yw-success-border); }
[data-style="modern"] .badge.text-bg-danger { background: var(--yw-danger-bg) !important; color: var(--yw-danger-text) !important; box-shadow: inset 0 0 0 1px var(--yw-danger-border); }
[data-style="modern"] .badge.text-bg-warning { background: var(--yw-warning-bg) !important; color: var(--yw-warning-text) !important; box-shadow: inset 0 0 0 1px var(--yw-warning-border); }
[data-style="modern"] .badge.text-bg-info { background: var(--yw-info-bg) !important; color: var(--yw-info-text) !important; box-shadow: inset 0 0 0 1px var(--yw-info-border); }
[data-style="modern"] .badge.text-bg-secondary { background: var(--yw-surface-2) !important; color: var(--yw-muted) !important; box-shadow: inset 0 0 0 1px var(--yw-border); }
[data-style="modern"] .alert {
border-radius: var(--yw-radius-sm);
}
[data-style="modern"] .badge {
border-radius: 999px;
font-weight: 600;
}
[data-style="modern"] hr {
border-color: var(--yw-border);
opacity: 1;
}
/* Narrow screens: the card becomes a wrapping row of pills; group
headings would only break the row, so they go. */
@media (max-width: 767.98px) {
[data-style="modern"] .sidebar {
border-bottom: 0;
padding: .25rem .75rem .5rem;
}
[data-style="modern"] .sidebar > .nav {
position: static;
padding: .35rem !important;
gap: .25rem;
}
[data-style="modern"] .yw-nav-group {
display: none;
}
[data-style="modern"] .sidebar .nav-link {
border-bottom: 0;
padding: .4rem .7rem;
}
[data-style="modern"] .sidebar .nav-link.active {
border-bottom: 0;
}
[data-style="modern"] .navbar {
padding: .7rem 1rem;
}
}