Watch
0
0
Fork
You've already forked hyperhive
0

frontend: light-theme terminal contrast, theme before first paint, color-scheme, motion and focus defaults

Light theme: the terminal and code blocks sat on --crust, a mid grey there, so text was 2:1 to 3:1. They now use --code-bg, which keeps 95% of a light palette's background (58% of the dark one's, as before); scrims and shadows keep --crust. Dark --muted goes from 4.44:1 to 4.72:1 on --bg. The stored theme and motion overrides are set by a blocking boot script in the head (the page allows no inline script), so a light OS no longer paints light before the dark default; a test keeps its keys in step with the shell. color-scheme follows the palette, so native controls and scrollbars match a forced theme. Five infinite animations (dashboard banner, container icon, pending badge, warn banner, spinner) now honour reduced motion and the in-app motion setting, ConnectionDot uses the same three-rule shape as the others, and the hive-warn element honours the system preference. Keyboard focus gets a default ring, and the cancel button and pane divider keep a visible one.
This commit is contained in:
iris 2026-11-19 18:35:43 +01:00 • committed by mara
commit 3d88108c4f
8 changed files with 257 additions and 23 deletions

View file

@ -5,6 +5,13 @@
`theme.css` + docs/4-implementation/web-ui/css-vars.md. Per-page stylesheets append on
top of this and must NOT redeclare the colour variables; `theme.css`
is the one source of truth. */
/* A visible ring on keyboard focus wherever a component has not drawn its own.
`:where` keeps the specificity at zero, so every component rule wins. The UA
ring is close to invisible on the dark, translucent surfaces. */
:where(:focus-visible) {
outline: 2px solid var(--purple);
outline-offset: 2px;
}
body {
/* The default UA stylesheet gives `body` an 8px margin — every page
using this shared base had it as a `--bg`-coloured strip visible
@ -34,6 +41,17 @@ body {
animation: spin 1s linear infinite;
color: var(--amber);
}
@media (prefers-reduced-motion: reduce) {
.spinner {
animation: none;
}
}
:root[data-motion="reduce"] .spinner {
animation: none;
}
:root[data-motion="allow"] .spinner {
animation: spin 1s linear infinite;
}
@keyframes spin {
from {
transform: rotate(0deg);

View file

@ -96,6 +96,9 @@
--base0D: var(--mocha-base0D);
--base0E: var(--mocha-base0E);
--base0F: var(--mocha-base0F);
/* The browser's own controls, scrollbars and dialog backdrops follow the
palette, so a forced theme does not leave them on the OS's. */
color-scheme: dark;
}
/* OS/browser-level light-mode default. This is a *default*, not a user
@ -131,6 +134,8 @@
/* Dimmed text on the light palette: see `--muted-share` in theme.css. */
--muted-share: 85%;
--subtext0-share: 93%;
--code-bg-share: 95%;
color-scheme: light;
}
}
@ -165,6 +170,8 @@
/* Dimmed text on the light palette: see `--muted-share` in theme.css. */
--muted-share: 85%;
--subtext0-share: 93%;
--code-bg-share: 95%;
color-scheme: light;
}
:root[data-theme="dark"] {
--base00: var(--mocha-base00);
@ -185,6 +192,8 @@
--base0F: var(--mocha-base0F);
/* A dark pick over a light OS preference: the media query's shares must not
carry over, so the dark palette sets its own, the defaults of theme.css. */
--muted-share: 55.5%;
--muted-share: 58%;
--subtext0-share: 77.7%;
--code-bg-share: 58%;
color-scheme: dark;
}

View file

@ -41,6 +41,13 @@
text-shadow: 0 0 6px color-mix(in srgb, currentColor 40%, transparent);
animation: hive-warn-pulse 2.4s ease-in-out infinite;
}
/* Inside a shadow tree, so the page's `data-motion` setting cannot reach it:
the system preference only. */
@media (prefers-reduced-motion: reduce) {
:host([level="error"]) {
animation: none;
}
}
@keyframes hive-warn-pulse {
0%,
100% {

View file

@ -174,7 +174,10 @@
.jg-cancel-btn:focus-visible {
color: var(--red);
border-color: var(--red);
outline: none;
}
.jg-cancel-btn:focus-visible {
outline: 2px solid var(--red);
outline-offset: 2px;
}
.jg-data {

View file

@ -14,7 +14,7 @@ html:root[data-solid="true"] .ui-badge:not(.ui-badge-quiet) {
backdrop-filter: none;
}
html:root[data-solid="true"] .terminal-wrap {
background: var(--crust);
background: var(--code-bg);
-webkit-backdrop-filter: none;
backdrop-filter: none;
}

View file

@ -18,7 +18,7 @@
.terminal-wrap {
position: relative;
background: color-mix(in srgb, var(--crust) 78%, transparent);
background: color-mix(in srgb, var(--code-bg) 78%, transparent);
-webkit-backdrop-filter: blur(8px) saturate(120%);
backdrop-filter: blur(8px) saturate(120%);
border: 1px solid var(--purple-dim);

View file

@ -33,10 +33,19 @@
in srgb,
var(--base00) 58%,
#000000
); /* terminal / code bg, below --bg */
); /* scrims and shadows: a darkened bg, in both themes */
/* The surface text sits on in a terminal or a code block. In the dark theme
it is `--crust`, below `--bg`. A light palette keeps nearly all of its
background (`--code-bg-share` in `colors.css`), as `--crust` is a mid
grey there and the text on it fell to 2:1. */
--code-bg: color-mix(
in srgb,
var(--base00) var(--code-bg-share, 58%),
#000000
);
--muted: color-mix(
in srgb,
var(--base05) var(--muted-share, 55.5%),
var(--base05) var(--muted-share, 58%),
var(--base00)
); /* secondary / dimmed text */
--subtext0: color-mix(
@ -46,7 +55,7 @@
); /* toolbar/status text; dimmer than --fg, lighter than --muted */
/* `--muted-share` and `--subtext0-share` are how much of the text colour each
mix keeps. A palette whose background is light sets them higher in
`colors.css`: at the dark palette's 55.5% the light one's muted text was
`colors.css`: at the dark palette's 58% the light one's muted text was
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. */

View file

@ -27,6 +27,17 @@
text-shadow: 0 0 6px color-mix(in srgb, currentColor 40%, transparent);
animation: warn-banner-pulse 2.4s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
.warn-banner-error {
animation: none;
}
}
:root[data-motion="reduce"] .warn-banner-error {
animation: none;
}
:root[data-motion="allow"] .warn-banner-error {
animation: warn-banner-pulse 2.4s ease-in-out infinite;
}
@keyframes warn-banner-pulse {
0%,
100% {