Watch
0
0
Fork
You've already forked hyperhive
0

frontend: one glass token pair in place of three copied light and dark blocks

Headers, badges, terminal panes, the message box and the dashboard's bars read --glass-clear and --glass-filter from theme.css; the light palette (colors.css) and the solid-backgrounds setting set them. Each surface keeps a single rule, the per-theme override blocks and the quiet-badge specificity workaround go, and the dashboard and agent page now follow the light palette like the swarm UI.
This commit is contained in:
iris 2026-11-19 20:49:40 +01:00 • committed by mara
commit 1ca82b3e09
10 changed files with 93 additions and 122 deletions

View file

@ -80,6 +80,15 @@ keeps 95% of its background in `--code-bg` (`--code-bg-share`), as `--crust` is
grey on a light palette and text on it fell to 2:1. A palette that sets none of these grey on a light palette and text on it fell to 2:1. A palette that sets none of these
variables, such as a generated one, keeps the dark shares. variables, such as a generated one, keeps the dark shares.
The frosted surfaces (the headers, the badges, the terminal panes, the message box and the
dashboard's banner) read two derived variables from `theme.css`. `--glass-clear` is `1`
for glass and `0` for solid: a surface keeps `calc(100% - its-share * var(--glass-clear))`
of its fill colour. `--glass-filter` is its `backdrop-filter`: a blur on the dark palette,
`none` on the light one, where bright content behind the glass would wash the text out.
The light palette sets `--palette-glass-clear` and `--palette-glass-filter` in `colors.css`,
and the dark palette resets them; the solid-backgrounds setting sets the two derived
variables itself. A new glass surface uses the two variables and needs no theme rules of its own.
## Common mistakes ## Common mistakes
The Catppuccin colour names **don't** map 1:1 to the variable names. The Catppuccin colour names **don't** map 1:1 to the variable names.

View file

@ -36,9 +36,13 @@ body.dashboard-shell {
gap: 0.75em; gap: 0.75em;
/* Stickiness lives on the `.sticky-top` wrapper (common.css) that /* Stickiness lives on the `.sticky-top` wrapper (common.css) that
common.js wraps this chrome in. */ common.js wraps this chrome in. */
background: color-mix(in srgb, var(--bg) 86%, transparent); background: color-mix(
-webkit-backdrop-filter: blur(8px) saturate(120%); in srgb,
backdrop-filter: blur(8px) saturate(120%); var(--bg) calc(100% - 14% * var(--glass-clear)),
transparent
);
-webkit-backdrop-filter: var(--glass-filter);
backdrop-filter: var(--glass-filter);
border-bottom: 1px solid var(--purple-dim); border-bottom: 1px solid var(--purple-dim);
padding: 0.3em 1em; padding: 0.3em 1em;
margin: 0 0 1em; margin: 0 0 1em;
@ -593,9 +597,13 @@ footer .banner-thin {
flex-wrap: wrap; flex-wrap: wrap;
gap: 0.6em; gap: 0.6em;
padding: 0.55em 1em; padding: 0.55em 1em;
background: color-mix(in srgb, var(--bg) 74%, transparent); background: color-mix(
-webkit-backdrop-filter: blur(12px) saturate(140%); in srgb,
backdrop-filter: blur(12px) saturate(140%); var(--bg) calc(100% - 26% * var(--glass-clear)),
transparent
);
-webkit-backdrop-filter: var(--glass-filter);
backdrop-filter: var(--glass-filter);
border-top: 1px solid var(--purple); border-top: 1px solid var(--purple);
box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.4); box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.4);
} }

View file

@ -13,54 +13,22 @@
font: inherit; font: inherit;
font-size: 0.85em; font-size: 0.85em;
line-height: 1.4; line-height: 1.4;
background: color-mix(in srgb, var(--purple-dim) 65%, transparent); /* Frosted glass (mara: "make badges look glassy... in dark mode the added
-webkit-backdrop-filter: blur(6px) saturate(140%); transparency improves readability, bg behind is dark"): translucent over a
backdrop-filter: blur(6px) saturate(140%); blur on the dark palette, solid on the light one (see `--glass-clear` in
theme.css). Same recipe as the header, the terminal panes and the message
box. */
background: color-mix(
in srgb,
var(--purple-dim) calc(100% - 35% * var(--glass-clear)),
transparent
);
-webkit-backdrop-filter: var(--glass-filter);
backdrop-filter: var(--glass-filter);
color: var(--fg); color: var(--fg);
border: none; border: none;
white-space: nowrap; white-space: nowrap;
} }
/* Frosted-glass fill (mara: "make badges look glassy... in dark mode
the added transparency improves readability, bg behind is dark") —
same recipe as the header chrome/terminal glass (`chrome.css`,
`terminal.css`): translucent `color-mix` + `backdrop-filter`. Only
for the default filled badges — `variant="quiet"` (below) already
has no fill at all, nothing to frost.
Dark (mocha) only, deliberately: her own reasoning was conditioned
on a dark surface behind the badge. A light (latte) page has bright,
often busy content behind a badge — the same transparency would
wash out the value text instead of improving it, the opposite of
what this is for — so light mode keeps the plain solid fill. Same
three-way structure `colors.css` uses for every light/dark switch:
this default rule *is* the dark look (mocha is the default palette),
the `@media`/`:root[data-theme]` blocks below revert it for light,
restore it for an explicit dark override. */
@media (prefers-color-scheme: light) {
.ui-badge {
background: var(--purple-dim);
-webkit-backdrop-filter: none;
backdrop-filter: none;
}
}
/* `:not(.ui-badge-quiet)` here, unlike the base rule/`@media` block
above — argus's review: both of these add `:root`+`[data-theme]` to
the selector, so specificity is 0-3-0 vs plain `.ui-badge-quiet`'s
0-1-0. Without the exclusion these would beat quiet's `background:
none` (below) whenever a user has an *explicit* theme override set
(SettingsMenu's dropdown, not just the OS default), reintroducing
the settings/links "should not have the badge bg" bug on those
triggers. Verified against a real repro before landing, not just
the specificity arithmetic. */
:root[data-theme="light"] .ui-badge:not(.ui-badge-quiet) {
background: var(--purple-dim);
-webkit-backdrop-filter: none;
backdrop-filter: none;
}
:root[data-theme="dark"] .ui-badge:not(.ui-badge-quiet) {
background: color-mix(in srgb, var(--purple-dim) 65%, transparent);
-webkit-backdrop-filter: blur(6px) saturate(140%);
backdrop-filter: blur(6px) saturate(140%);
}
/* The base `.ui-badge` rule's `border-radius: 1em` is a genuine pill at /* The base `.ui-badge` rule's `border-radius: 1em` is a genuine pill at
its own compact display-only height, but `min-height: 2.75em` below its own compact display-only height, but `min-height: 2.75em` below
(the WCAG 2.5.5 touch-target floor) makes an *interactive* badge tall (the WCAG 2.5.5 touch-target floor) makes an *interactive* badge tall
@ -92,6 +60,8 @@
the idle background, which is what mara's report was actually about. */ the idle background, which is what mara's report was actually about. */
.ui-badge-quiet { .ui-badge-quiet {
background: none; background: none;
-webkit-backdrop-filter: none;
backdrop-filter: none;
} }
.ui-badge-interactive[aria-expanded="true"] { .ui-badge-interactive[aria-expanded="true"] {
background: var(--bg-elev); background: var(--bg-elev);

View file

@ -16,9 +16,13 @@
.page-header { .page-header {
/* Stickiness lives on the `.sticky-top` wrapper (common.css) that /* Stickiness lives on the `.sticky-top` wrapper (common.css) that
common.js wraps this header in. */ common.js wraps this header in. */
background: color-mix(in srgb, var(--bg) 92%, transparent); background: color-mix(
-webkit-backdrop-filter: blur(8px) saturate(120%); in srgb,
backdrop-filter: blur(8px) saturate(120%); var(--bg) calc(100% - 8% * var(--glass-clear)),
transparent
);
-webkit-backdrop-filter: var(--glass-filter);
backdrop-filter: var(--glass-filter);
border-bottom: 1px solid var(--purple-dim); border-bottom: 1px solid var(--purple-dim);
display: flex; display: flex;
/* Keep the back-link + sub-tab nav on one row. Without an explicit /* Keep the back-link + sub-tab nav on one row. Without an explicit

View file

@ -135,6 +135,9 @@
--muted-share: 85%; --muted-share: 85%;
--subtext0-share: 93%; --subtext0-share: 93%;
--code-bg-share: 95%; --code-bg-share: 95%;
/* No frosted glass on the light palette: see `--glass-clear` in theme.css. */
--palette-glass-clear: 0;
--palette-glass-filter: none;
color-scheme: light; color-scheme: light;
} }
} }
@ -171,6 +174,8 @@
--muted-share: 85%; --muted-share: 85%;
--subtext0-share: 93%; --subtext0-share: 93%;
--code-bg-share: 95%; --code-bg-share: 95%;
--palette-glass-clear: 0;
--palette-glass-filter: none;
color-scheme: light; color-scheme: light;
} }
:root[data-theme="dark"] { :root[data-theme="dark"] {
@ -195,5 +200,7 @@
--muted-share: 58%; --muted-share: 58%;
--subtext0-share: 77.7%; --subtext0-share: 77.7%;
--code-bg-share: 58%; --code-bg-share: 58%;
--palette-glass-clear: initial;
--palette-glass-filter: initial;
color-scheme: dark; color-scheme: dark;
} }

View file

@ -1,25 +1,9 @@
/* The frosted surfaces, made opaque while `data-solid="true"` is on `<html>` /* The frosted surfaces, made opaque while `data-solid="true"` is on `<html>`
(`solid-backgrounds.tsx`). Each rule names the same surface as the rule that (`solid-backgrounds.tsx`): the two glass tokens of `theme.css` go to solid,
makes it see-through, with `html:root` in front so it outranks that rule's and every glass surface follows. `html:root` outranks theme.css's `:root`
theme variants whatever order the stylesheets load in. The dialog scrim is whatever order the stylesheets load in. The dialog scrim is left alone: it
left alone: it dims the page on purpose. */ dims the page on purpose. */
html:root[data-solid="true"] .shell-header { html:root[data-solid="true"] {
background: var(--bg-elev); --glass-clear: 0;
-webkit-backdrop-filter: none; --glass-filter: none;
backdrop-filter: none;
}
html:root[data-solid="true"] .ui-badge:not(.ui-badge-quiet) {
background: var(--purple-dim);
-webkit-backdrop-filter: none;
backdrop-filter: none;
}
html:root[data-solid="true"] .terminal-wrap {
background: var(--code-bg);
-webkit-backdrop-filter: none;
backdrop-filter: none;
}
html:root[data-solid="true"] .ui-agent-input-form {
background: var(--bg-elev);
-webkit-backdrop-filter: none;
backdrop-filter: none;
} }

View file

@ -18,9 +18,13 @@
.terminal-wrap { .terminal-wrap {
position: relative; position: relative;
background: color-mix(in srgb, var(--code-bg) 78%, transparent); background: color-mix(
-webkit-backdrop-filter: blur(8px) saturate(120%); in srgb,
backdrop-filter: blur(8px) saturate(120%); var(--code-bg) calc(100% - 22% * var(--glass-clear)),
transparent
);
-webkit-backdrop-filter: var(--glass-filter);
backdrop-filter: var(--glass-filter);
border: 1px solid var(--purple-dim); border: 1px solid var(--purple-dim);
box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.7); box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.7);
border-radius: 4px; border-radius: 4px;

View file

@ -59,6 +59,17 @@
2.4:1 against its card background, short of the 4.5:1 AA asks for. A palette 2.4:1 against its card background, short of the 4.5:1 AA asks for. A palette
that sets neither keeps the shares above. */ that sets neither keeps the shares above. */
/* The frosted-glass surfaces (headers, badges, terminal panes, the message
box) are see-through over a blur on the dark palette and solid on the light
one, where bright content behind them would wash the text out.
`--glass-clear` is 1 for glass and 0 for solid; a surface keeps
`calc(100% - its-clear-share * var(--glass-clear))` of its fill colour, and
`--glass-filter` is its `backdrop-filter`. A light palette sets
`--palette-glass-clear` and `--palette-glass-filter` in `colors.css`, and
the solid-backgrounds setting sets the two final tokens itself. */
--glass-clear: var(--palette-glass-clear, 1);
--glass-filter: var(--palette-glass-filter, blur(8px) saturate(130%));
/* `--muted`, above, is mixed toward `--base00`/`--bg` — correct for /* `--muted`, above, is mixed toward `--base00`/`--bg` — correct for
dimmed text on the page background, wrong for dimmed text sitting on dimmed text on the page background, wrong for dimmed text sitting on
an elevated fill like `--purple-dim` (badge/dropdown-item an elevated fill like `--purple-dim` (badge/dropdown-item

View file

@ -39,31 +39,18 @@
/* Frosted glass, the recipe of the badges (`Badge.css`): translucent over a /* Frosted glass, the recipe of the badges (`Badge.css`): translucent over a
blur, so the rows scroll behind it. Dark only, as there: on a light page blur, so the rows scroll behind it. Dark only, as there: on a light page
the busy content behind would wash the text out, so light keeps the solid the busy content behind would wash the text out, so light keeps the solid
fill. */ fill (`--glass-clear` in theme.css). */
background: color-mix(in srgb, var(--bg-elev) 55%, transparent); background: color-mix(
-webkit-backdrop-filter: blur(10px) saturate(140%); in srgb,
backdrop-filter: blur(10px) saturate(140%); var(--bg-elev) calc(100% - 45% * var(--glass-clear)),
transparent
);
-webkit-backdrop-filter: var(--glass-filter);
backdrop-filter: var(--glass-filter);
box-shadow: box-shadow:
0 0.3em 1em rgba(0, 0, 0, 0.45), 0 0.3em 1em rgba(0, 0, 0, 0.45),
0 0 0 1px color-mix(in srgb, var(--purple) 12%, transparent); 0 0 0 1px color-mix(in srgb, var(--purple) 12%, transparent);
} }
@media (prefers-color-scheme: light) {
.ui-agent-input-form {
background: var(--bg-elev);
-webkit-backdrop-filter: none;
backdrop-filter: none;
}
}
:root[data-theme="light"] .ui-agent-input-form {
background: var(--bg-elev);
-webkit-backdrop-filter: none;
backdrop-filter: none;
}
:root[data-theme="dark"] .ui-agent-input-form {
background: color-mix(in srgb, var(--bg-elev) 55%, transparent);
-webkit-backdrop-filter: blur(10px) saturate(140%);
backdrop-filter: blur(10px) saturate(140%);
}
.ui-agent-input-form:focus-within { .ui-agent-input-form:focus-within {
border-color: var(--purple); border-color: var(--purple);
box-shadow: box-shadow:

View file

@ -22,8 +22,8 @@
/* Sticky + frosted glass (mara: "sticky header bar ... frosted glass") /* Sticky + frosted glass (mara: "sticky header bar ... frosted glass")
— same `color-mix` + `backdrop-filter` recipe `.terminal-wrap`/ — same `color-mix` + `backdrop-filter` recipe `.terminal-wrap`/
`.ui-badge` (@hive/shared) already use, dark-only same as those (a `.ui-badge` (@hive/shared) already use, dark-only same as those (a
light bg behind glass washes out). `z-index` keeps it above light bg behind glass washes out; `--glass-clear` in theme.css).
`.shell-body` once content scrolls underneath. */ `z-index` keeps it above `.shell-body` once content scrolls underneath. */
.shell-header { .shell-header {
display: flex; display: flex;
align-items: center; align-items: center;
@ -31,30 +31,17 @@
gap: 1.5em; gap: 1.5em;
padding: 0.75em 1.25em; padding: 0.75em 1.25em;
border-bottom: 1px solid var(--border); border-bottom: 1px solid var(--border);
background: color-mix(in srgb, var(--bg-elev) 80%, transparent); background: color-mix(
-webkit-backdrop-filter: blur(8px) saturate(120%); in srgb,
backdrop-filter: blur(8px) saturate(120%); var(--bg-elev) calc(100% - 20% * var(--glass-clear)),
transparent
);
-webkit-backdrop-filter: var(--glass-filter);
backdrop-filter: var(--glass-filter);
position: sticky; position: sticky;
top: 0; top: 0;
z-index: 10; z-index: 10;
} }
@media (prefers-color-scheme: light) {
.shell-header {
background: var(--bg-elev);
-webkit-backdrop-filter: none;
backdrop-filter: none;
}
}
:root[data-theme="light"] .shell-header {
background: var(--bg-elev);
-webkit-backdrop-filter: none;
backdrop-filter: none;
}
:root[data-theme="dark"] .shell-header {
background: color-mix(in srgb, var(--bg-elev) 80%, transparent);
-webkit-backdrop-filter: blur(8px) saturate(120%);
backdrop-filter: blur(8px) saturate(120%);
}
/* The swarm name links to the start page; the link adds no look of its own, /* The swarm name links to the start page; the link adds no look of its own,
so the brand's accent and glow (on the span inside) are all that show. */ so the brand's accent and glow (on the span inside) are all that show. */
.shell-brand-link { .shell-brand-link {