feat(ui): a light theme, following the browser, with a toggle in the masthead
Dark, light, or whatever the browser asks for. Auto is the default, so a reader who has never touched it gets their own system's answer rather than ours. The light palette is selected, not inverted. `#bd8829` carries every magnitude on this site at 6.6:1 against the warm-black and **2.77:1** against paper — the validator says so, and 2.77 is under the 3:1 floor a mark has to clear. So light mode gets its own step of the same bronze, and its `--data-bright` sits *darker* than `--data`, because emphasis on paper is weight rather than glare. Same for the washes: a glow at 0.08 alpha on warm-black is a smear at 0.08 on paper, so the nine colour literals that were still loose in the stylesheet became tokens — each one was a colour the second theme could not have overridden. Every value was chosen by running the dataviz validator against the surface it actually sits on, both modes. The single-hue rule is untouched and still load-bearing in both: bronze and crimson fail CVD separation as a categorical pair whichever ground they are on. `auto` is a preference rather than a third palette. It resolves to a concrete `light` or `dark` before the stylesheet ever sees it, which is what keeps this to one definition per palette instead of one per palette per media query — and it has to resolve before the *first paint*, because anything running after the bundle loads runs after the page has been painted once, and on a light preference that is a full-screen flash of warm-black. Hence the inline script, whose duplication of `lib/theme.ts` is the cheaper of the two costs. Two things that would otherwise bite: `localStorage` throws rather than returning null where site data is blocked, so every access is guarded and falls back to what the browser wants; and `auto` keeps listening, so a machine that turns dark at sunset does not leave a reader on the daylight palette until they reload. The toggle shows the state it is in, never the state it would move to — a control that displays its own destination is why these get guessed at — and its accessible name carries that state, since the icon cannot. Checked in a browser, both themes, on the standings, a miner page and the share chart. Worth recording what that turned up: dark carries 46 text elements under 4.5:1 and light carries 3, each beating its dark counterpart. The gap is `--text-muted` at 3.7, the deliberate existing value CLAUDE.md has always documented — not introduced here, and not something to change without deciding to change the dark design. Closes #12 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Jp6a8EDar9ueEhAxzep4V5
This commit is contained in:
+125
-10
@@ -16,7 +16,30 @@
|
||||
* labels and row treatment, never by a second colour a reader has to tell apart.
|
||||
*/
|
||||
|
||||
:root {
|
||||
/* Two palettes, both selected rather than computed from each other.
|
||||
*
|
||||
* A light theme is not a dark theme with the lightness inverted. The bronze
|
||||
* that carries every magnitude on this site reads at 6.6:1 against the
|
||||
* warm-black and only **2.77:1** against paper — the validator says so — so
|
||||
* light mode gets its own step of the same hue, dark enough to hold the
|
||||
* surface, and the emphasis step moves *down* rather than up because on paper
|
||||
* darker is louder. Every value below was chosen by the dataviz validator
|
||||
* against the surface it actually sits on:
|
||||
*
|
||||
* node <skill>/scripts/validate_palette.js "#bd8829" --mode dark --surface "#14110d"
|
||||
* node <skill>/scripts/validate_palette.js "#a8741c" --mode light --surface "#f5f1e8"
|
||||
*
|
||||
* Re-run both after touching any of them. The single-hue rule is unchanged and
|
||||
* still load-bearing: bronze and crimson are adjacent hues that fail CVD
|
||||
* separation as a categorical pair, in either theme.
|
||||
*
|
||||
* `data-theme` is always a concrete `dark` or `light`, resolved before first
|
||||
* paint by the inline script in `index.html`. "Auto" is a stored *preference*,
|
||||
* not a third set of values — which is what keeps this file to one definition
|
||||
* per palette instead of one per palette per media query.
|
||||
*/
|
||||
:root,
|
||||
:root[data-theme='dark'] {
|
||||
color-scheme: dark;
|
||||
|
||||
/* Surfaces, warm-black — a cold grey reads as a developer tool, not a arena. */
|
||||
@@ -49,10 +72,69 @@
|
||||
--font-body: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
|
||||
--font-mono: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;
|
||||
|
||||
/* Washes and glows, kept as tokens because each one is a colour and the
|
||||
light theme needs its own. A wash that works as a glow on warm-black is a
|
||||
smear on paper at the same alpha. */
|
||||
--glow: rgba(189, 136, 41, 0.08);
|
||||
--good-halo: rgba(63, 157, 118, 0.18);
|
||||
--data-chip: rgba(189, 136, 41, 0.18);
|
||||
--row-rule: rgba(47, 39, 25, 0.55);
|
||||
--mine-hover: rgba(216, 69, 58, 0.16);
|
||||
--warn-border: rgba(217, 164, 65, 0.4);
|
||||
--failed-chip: rgba(216, 69, 58, 0.12);
|
||||
|
||||
--rule: 1px solid var(--border);
|
||||
--shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
|
||||
}
|
||||
|
||||
/* Light. Contrast against --surface-1: 15.8, 6.9, 4.2 — the ink; then 3.6 for
|
||||
* the data hue, 4.8 for the accent, 3.9 and 3.8 for the two status colours.
|
||||
* All above the 3:1 the validator holds marks to, and the ink above 4.5.
|
||||
*/
|
||||
:root[data-theme='light'] {
|
||||
color-scheme: light;
|
||||
|
||||
/* Warm paper, for the same reason the dark surfaces are warm-black: a cold
|
||||
grey reads as a developer tool. Elevation runs the other way here — the
|
||||
page is the lightest thing and each step above it is *darker*, which keeps
|
||||
the ordering of visual weight the dark theme has. */
|
||||
--surface-0: #fbf8f2;
|
||||
--surface-1: #f5f1e8;
|
||||
--surface-2: #ece7da;
|
||||
--surface-3: #e2dbc9;
|
||||
--border: #d9d0ba;
|
||||
--border-strong: #b8ab8d;
|
||||
|
||||
--text-primary: #1b1710;
|
||||
--text-secondary: #5b5142;
|
||||
--text-muted: #7c7263;
|
||||
|
||||
/* The bronze, re-stepped. `--data-bright` is *darker* than `--data`: it is
|
||||
the emphasis step, and emphasis on paper is weight, not glare. */
|
||||
--data: #a8741c;
|
||||
--data-bright: #8a5f10;
|
||||
--data-wash: rgba(168, 116, 28, 0.12);
|
||||
|
||||
--accent: #c3382d;
|
||||
--accent-bright: #a82c20;
|
||||
--accent-wash: rgba(195, 56, 45, 0.1);
|
||||
|
||||
--good: #0f8a58;
|
||||
--warn: #b8651a;
|
||||
|
||||
--glow: rgba(168, 116, 28, 0.09);
|
||||
--good-halo: rgba(15, 138, 88, 0.16);
|
||||
--data-chip: rgba(168, 116, 28, 0.16);
|
||||
--row-rule: rgba(184, 171, 141, 0.5);
|
||||
--mine-hover: rgba(195, 56, 45, 0.1);
|
||||
--warn-border: rgba(184, 101, 26, 0.45);
|
||||
--failed-chip: rgba(195, 56, 45, 0.09);
|
||||
|
||||
/* Down rather than up: an inset white highlight is how a dark surface catches
|
||||
the light, and on paper the same gesture is a shadow. */
|
||||
--shadow: 0 1px 0 rgba(27, 23, 16, 0.04) inset;
|
||||
}
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
@@ -68,8 +150,7 @@ body {
|
||||
background:
|
||||
/* A faint warm glow behind the masthead, so the page has a top rather than
|
||||
being a flat field. Fixed so it does not travel with the scroll. */
|
||||
radial-gradient(120% 60% at 50% -10%, rgba(189, 136, 41, 0.08), transparent 60%),
|
||||
var(--surface-0);
|
||||
radial-gradient(120% 60% at 50% -10%, var(--glow), transparent 60%), var(--surface-0);
|
||||
background-attachment: fixed;
|
||||
color: var(--text-primary);
|
||||
font-family: var(--font-body);
|
||||
@@ -192,6 +273,40 @@ a {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
/* ---- theme toggle -------------------------------------------------------- */
|
||||
|
||||
.theme-toggle {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
/* 32px, which is the smallest a lone icon control can be and still be a
|
||||
comfortable target on a touch screen. The icon inside is 16. */
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
padding: 0;
|
||||
border: var(--rule);
|
||||
border-radius: 999px;
|
||||
background: var(--surface-1);
|
||||
color: var(--text-secondary);
|
||||
cursor: pointer;
|
||||
/* Not the colour: `color-scheme` repaints the scrollbar and the form chrome
|
||||
at the same instant, and a 150ms fade on the page while the gutter snaps is
|
||||
worse than both moving together. */
|
||||
transition:
|
||||
border-color 0.15s ease,
|
||||
color 0.15s ease;
|
||||
}
|
||||
|
||||
.theme-toggle:hover {
|
||||
color: var(--data-bright);
|
||||
border-color: var(--border-strong);
|
||||
}
|
||||
|
||||
.theme-toggle:focus-visible {
|
||||
outline: 2px solid var(--data);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
/* ---- connection light ---------------------------------------------------- */
|
||||
|
||||
.status {
|
||||
@@ -214,7 +329,7 @@ a {
|
||||
|
||||
.status-live .status-dot {
|
||||
background: var(--good);
|
||||
box-shadow: 0 0 0 3px rgba(63, 157, 118, 0.18);
|
||||
box-shadow: 0 0 0 3px var(--good-halo);
|
||||
}
|
||||
|
||||
.status-reconnecting .status-dot,
|
||||
@@ -343,7 +458,7 @@ a {
|
||||
|
||||
.chain-chip.is-active .chain-nodes {
|
||||
color: var(--data-bright);
|
||||
background: rgba(189, 136, 41, 0.18);
|
||||
background: var(--data-chip);
|
||||
}
|
||||
|
||||
/* ---- stat tiles ---------------------------------------------------------- */
|
||||
@@ -619,7 +734,7 @@ a.ticker-height:hover {
|
||||
|
||||
.board td {
|
||||
padding: 9px 14px;
|
||||
border-bottom: 1px solid rgba(47, 39, 25, 0.55);
|
||||
border-bottom: 1px solid var(--row-rule);
|
||||
text-align: right;
|
||||
white-space: nowrap;
|
||||
}
|
||||
@@ -641,7 +756,7 @@ a.ticker-height:hover {
|
||||
}
|
||||
|
||||
.board tbody tr.mine:hover {
|
||||
background: rgba(216, 69, 58, 0.16);
|
||||
background: var(--mine-hover);
|
||||
}
|
||||
|
||||
.rank {
|
||||
@@ -791,7 +906,7 @@ tr.mine .share-bar > i {
|
||||
gap: 12px;
|
||||
align-items: baseline;
|
||||
padding: 8px 18px;
|
||||
border-bottom: 1px solid rgba(47, 39, 25, 0.55);
|
||||
border-bottom: 1px solid var(--row-rule);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
@@ -907,7 +1022,7 @@ tr.mine .share-bar > i {
|
||||
}
|
||||
|
||||
.banner-warn {
|
||||
border-color: rgba(217, 164, 65, 0.4);
|
||||
border-color: var(--warn-border);
|
||||
color: var(--warn);
|
||||
}
|
||||
|
||||
@@ -1280,7 +1395,7 @@ tr.mine .share-bar > i {
|
||||
.chip-failed {
|
||||
color: var(--accent-bright);
|
||||
border-color: var(--accent);
|
||||
background: rgba(216, 69, 58, 0.12);
|
||||
background: var(--failed-chip);
|
||||
}
|
||||
|
||||
/* A hashrate and how far to trust it. The error rides beside the figure rather
|
||||
|
||||
Reference in New Issue
Block a user