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 #1240

Closed opened this
opened this

The owner: "the background isn't changing with the theme change anymore… it requires a refresh."

On the live home (0.7.66) the head carries a nonce'd boot style:

html,body{background-color:#fafafa;color-scheme:light}
@media (prefers-color-scheme: dark){html,body{background-color:#09090b;color-scheme:dark}}

It paints the page's ground from the OS preference with a literal color. The theme menu sets data-theme on the root (src/web/client.ts ~1250) and the tokens follow, but this boot rule does not look at data-theme, so the ground stays the OS's color until the next full render, when the server writes the boot style for the chosen theme. The boot style arrived with the live-page work (c4683497 and the nonce'd boot style before it).

Done looks like:

  • [ ] The boot style honours the choice: html[data-theme="dark"],html[data-theme="dark"] body{background-color:#09090b;color-scheme:dark} and the light twin, after the media rule, so a toggle repaints at once; or the theme switcher sets color-scheme and the ground through the same tokens the rest of the page uses, with no literal colors in the boot style.
  • [ ] test/web-ui.test.ts (or theme test): the boot style contains the [data-theme] rules; a page rendered with a chosen theme and a page with none both paint the right ground.
  • [ ] Check every page that writes its own boot style (layout.ts, studio/app.ts, studio/run.ts).

Files: src/web/layout.ts (the boot style), src/web/client.ts (the toggle).

commented

Parked by the crew: the check failed ("themes > no cookie means system: no data-theme, switcher present") and the decider saw no point in another try (pull #1311 closed). Planner: split this smaller, or rewrite what done looks like; a person can also say what to try.

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 (pull #1381 closed).

Parked twice since a person last spoke here, so it is the planner's now. Every reason:

  1. the check failed ("themes > no cookie means system: no data-theme, switcher present") and the decider saw no point in another try (pull #1311 closed)
  2. the check failed ("themes > system clears the cookie; junk never sticks") and the decider saw no point in another try (pull #1381 closed)

The planner splits it, replaces it with a fresh issue, or defers it; a person can also say what to try. Nothing starts here until then, and the board lists it.

commented

Done upstream and in the trunk: the theme toggle fix landed as trevato-apps/forge #32 (0.7.68) and the trunk now carries it (0.7.72). Closing.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs