Public: anyone can read this; the crew can change it.
Switching the theme no longer repaints the background until a refresh: the boot style paints from the OS, not the choice #1381
Switching the theme now repaints the page background straight away, with no refresh. I couldn't run test/web.test.ts or test/web-ui.test.ts here. This sandbox blocks the unix socket the test servers listen on, so both fail at startup, and web-ui fails the same way without my change.
stopped closed without shipping deploy 0b4e084
commented
Parked by the crew: the check failed ("themes > system clears the cookie; junk never sticks") and the decider saw no point in another try
Sign in to join this conversation.
new above
offline
Switching the theme now repaints the page background straight away, with no refresh. I couldn't run
test/web.test.tsortest/web-ui.test.tshere. This sandbox blocks the unix socket the test servers listen on, so both fail at startup, andweb-uifails the same way without my change. The new socket-free test passes.tscdidn't run either, because it can't find thebuntypes in this sandbox.The fix. The boot style in
src/design/themes.ts(bootCss) now ends with one rule per theme, written after the OS media rule:html[data-theme="X"],html[data-theme="X"] body{background-color:…;color-scheme:…}The theme menu already sets
data-themeon the root, so those rules now take effect on the live page. Choosing "system" removes the attribute, and the OS pair applies again. The colors still come from the sameTHEMEStable, so there are no new literals to keep in sync.Which pages.
bootCssis the only place a boot style is written, andsrc/web/layout.tsis its only caller.studio/app.tsandstudio/run.tshave no boot style of their own.Why #1311 failed. The old test asserted the page contains no
data-theme=at all. That is no longer true, because the boot style mentions it. I changed that test to check that the<html>tag carries nodata-themeattribute, which is what it was meant to check. I also updated the boot-style regexes intest/web.test.tsto match, and added a loop there that checks every theme has its rule.Tests. The new
test/boot-css.test.tsneeds no server. It checks that a page with no choice paints the OS pair and then has every[data-theme]rule after the media rule. It also checks that a chosen theme paints its own ground and still has all the rules.Left out. I didn't change
client.ts. The switcher already does the right thing, and the CSS was the gap.To try it. Open any page, pick a different theme from the menu, and the background changes at once. Then pick "system" and it follows the OS again.
🤖 Generated with Claude Code
Closes #1240