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

@ -38,13 +38,13 @@ hoisted across files, and top-level statements run in path order. Find code by n
| `88-days/` | `dayTick()`, new offers, badges, `checkGoals()` |
| `90-actions/` | The `ACT` map, one file per area (`const ACT` in `10-interface.js`, `Object.assign(ACT,…)` in the rest), and their helpers |
| `91-save.js`, `92-audio.js` | Save, export and import; sound effects |
| `93-ui/` | DOM helpers (`$`, `btn`, `morph`), the phone tab bar, install pitch, HUD, left panel, city and link panels, decommissioning |
| `93-ui/` | DOM helpers (`$`, `btn`, `morph`), the theme (light, dark or Auto: `15-theme.js`), the phone tab bar, install pitch, HUD, left panel, city and link panels, decommissioning |
| `94-dashboard/` | Scenario and level progress, where to meet a network, customers and connections overviews, cities with no POP yet, lease swaps, the NOC dashboard and its own window for a second display (`90-noc-window.js`: this page at `?noc=<slot>`, a read-only copy of `S` and `R` over a BroadcastChannel, clicks sent back to the game; `91-noc-wall.js`: its wallboard), the bank, hints |
| `95-modals/` | Toasts, notifications, modals, title screen, what's new, help, the link and own-cable modals |
| `96-map/` | The canvas: resize, land and clouds, settings, level of detail, link geometry, how each tube looks, the WebGL map (the default, 2D as fallback: context, background, tubes, and the sprite atlas cities, labels and markers are drawn from, in 2D too), `draw()`, the world layer, cities, input and click delegation |
| `96-map/` | The canvas: resize, the map's colours per theme (`15-palette.js`), land and clouds, settings, level of detail, link geometry, how each tube looks, the WebGL map (the default, 2D as fallback: context, background, tubes, and the sprite atlas cities, labels and markers are drawn from, in 2D too), `draw()`, the world layer, cities, input and click delegation |
| `99-loop.js` | `frame()` and `boot()` |
`src/styles/` holds the CSS the same way: base, HUD, drawers, toasts, modal, tablet, then phone.
`src/styles/` holds the CSS the same way: base, the dark theme's colours (`05-theme.css`), HUD, drawers, toasts, modal, tablet, then phone.
`src/agent/` is the agent facade (`window.TUBES`): the typed commands, reads and screens the MCP server plays
through. It is assembled into the **development page** only (`npm run dev`, the MCP server, tests that ask for it);