Repository navigation
Give the board a palette of its own, so a theme can move it - #77
Merged
Merged
Conversation
The board has never carried colours. readTokens() in hud/scene.js reads nine custom properties off the page and paints from what it read, which is how the light/dark button moves the drawing with it. That was already the whole mechanism a theme needs; what was missing was somewhere for one to stand. So the nine become --board-*, declared once in style.css and each defaulting to the page token it used to name. Nothing about the light/dark path changed: the defaults follow the page into both grounds, because a var() resolves where it is used rather than where it is declared. What is new is that a stylesheet can now redefine them without reaching past the drawing and repainting the panels around it. A theme is a folder under ui/hud/themes/ with theme.json and theme.css in it. themes.go walks the embedded UI at startup and serves what it found at /api/themes, so the picker is populated from the server rather than from a list in the markup — adding a theme is a folder and a rebuild, and nothing else is edited. That is the same shape panels.go already has. Two themes ship. `chapter` overrides nothing and is the board exactly as it was; a test fails if it ever starts to, because a second copy of those nine colours is the copy that goes stale. `warroom` is amber on a dark ground, and exists so the seam is demonstrated rather than asserted. A theme that does not parse, or whose id disagrees with its folder, is skipped with a line at the console and the rest of the store still loads — the choice missing() already makes for set-pieces, for the same reason. theme.json's `ground` is advisory: selecting a theme drawn for dark moves the page there, and the light/dark button still wins afterwards. Measured against the running lab on 2026-09-12: /api/themes serves both, both stylesheets are served, selecting warroom moves --board-accent from #0d7a6f to #e8a33d while --accent is untouched, pressing the theme button afterwards changes the ground and leaves the palette, and selecting chapter again leaves --board-accent and --accent identical. No console errors.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Target
develop: the normal case for a fix, a chapter, alab change, a typo
develop→main, shipping to the published guidemain, because published advice iscurrently locking readers out or leaving them exposed
What this changes
The board's nine colours move from the page's own tokens to nine
--board-*properties that default to them, which gives a stylesheet somewhere to stand
between the page and the drawing. A theme is then a folder under
control/ui/hud/themes/holdingtheme.jsonandtheme.css;themes.gowalks the embedded UI at startup and serves what it found at
/api/themes, soadding one is a folder and a rebuild with no list edited anywhere.
No issue — this was asked for directly. It is the first of a planned series;
what is deliberately not in it is listed at the bottom.
Kind
If this changes advice or a command
Not advice, but it changes behaviour, so it was measured rather than assumed.
What I ran, and what it printed:
colours were only ever read in one place,
readTokens()inhud/scene.jslab/README.mdgains aThemes for the board section with the nine properties and what each paints
Checks
make -C lab checkpasses — "Everything held."gofmtis clean (make checkfails on any output at all)SPDX-License-IdentifierheaderIf this touches the guide's pages
It does not. Everything here is under
lab/, which is the control server andits embedded UI. The guide's own pages,
assets/andnav.jsare untouched.If this touches the lab or sandbox engine
The engine is untouched: no probe, no attack, no rung and no
Resultchanged.The only edit inside
hud/is the nine property namesreadTokens()reads.Ticked because they were checked, not because they were assumed:
dangerstill outranksoklab/README.mdmoved with it — noscore moved; the 27 board-rule tests pass unchanged
Licence
CC BY-SA 4.0 (guide) or GPL-3.0-or-later (code), per the file I touched
Not in this change
Kept out on purpose, one idea per branch:
counters — rather than four separate SSE streams and a parser per consumer.
That is its own branch and its own conversation.
manifest rather than by
index.html. Needs the feed first.warroomis here as proof the seam holds, not as afinished look; it moves nine colours and nothing else, because nine colours
is all a theme can reach today.
//go:embed-ed, so a theme needs arebuild. A mounted directory would remove that, and would also mean the
control server — which holds the Docker socket — loading JavaScript from
disk. Worth doing deliberately, later, if at all.