Dark mode: Light, Dark or Auto under Settings › Theme (#80)

A device preference (localStorage sot-theme, never in the save), applied
by a small script in <head> before the first paint, so there is no flash;
Auto follows prefers-color-scheme live, and a choice reaches other tabs
and the NOC window. Panels, HUD, drawers, toasts, modals, the phone tab
bar, charts, puzzles, the architect and Pie Control take their colours
from custom properties with night values (AA text contrast); light tints
keep their old colour as the fallback, so the light look is unchanged.

Both map renderers read a light and a dark palette (96-map/15-palette.js):
sea, land, clouds, coastlines, labels and the tube outline. A theme
switch repaints the cached layers once (the WebGL land buffers are
rebuilt once); nothing changes per frame. The multiplayer leaderboard's
own row and the menu rank badge follow the theme too.
This commit is contained in:
jvanvik 2026-11-07 01:01:50 +01:00
parent 95aa9b6532
commit 2cd6b71198
49 changed files with 645 additions and 155 deletions

View file

@ -52,7 +52,7 @@ test('src: partials follow the layout rules (docs/adr/0002-one-page-assembled-at
for (const dev of [false, true]) {
const { html, map } = assemble({ dev });
assert.equal((html.match(/^const ACT=\{$/gm) || []).length, 1, 'ACT is declared once; other action files use Object.assign(ACT,{…})');
assert.equal([...new JSDOM(html).window.document.scripts].filter((s) => !s.attributes.length).length, 2, 'the language loader and the game: one inline game script');
assert.equal([...new JSDOM(html).window.document.scripts].filter((s) => !s.attributes.length).length, 3, 'the theme, the language loader and the game: one inline game script');
assert.ok(map.length > 50 && map.every((m) => m.to >= m.from), 'the line map covers every partial');
}
});