Skip to content

Desktop: text, links and bullets take the new theme's colours after a switch (#436) - #496

Open
MopigamesYT wants to merge 2 commits into
devfrom
fix/436-theme-switch-stale-colours
Open

MopigamesYT wants to merge 2 commits into
devfrom
fix/436-theme-switch-stale-colours

Conversation

@MopigamesYT

Copy link
Copy Markdown
Member

Closes #436

Summary

After switching themes (theme file → theme file, light ↔ dark, accent change), markdown text, bullets, links and similar could keep the previous theme's colours while the sidebar and background were already new.

Screenshots

None: the bug is intermittent and I did not reproduce it on VM 111; the regression test reproduces it (fails before the fix, passes after).

Technical details

  • repaint recolours by mapping each old colour found in the window to the new one. That map cannot tell apart two tokens that shared one colour (first wins), and ignores colours that are not exactly a token. Markdown blocks (flowText) build their text, bullets and link rules with colours baked in, so they kept the old ones.
  • flowText.repaint (internal/ui/theming.go) now also marks the block as stale (paintedWidth = -1), so the next refresh lays it out again from the colours now in use.
  • Regression test: internal/ui/theme_switch_colours_test.go (text and accent the same colour before the switch).
  • Not changed: the Fyne theme override cache (third_party/fyne/internal/cache/theme.go) holds only per-object theme scopes, not resolved colours.
  • Desktop: nothing redraws when idle, cheaper theme changes (#474) #489 (not merged): it touches themeChanged/repaint signature (repaint(changed, fontsChanged)) in theming.go, so a small textual conflict is likely near repaint; the change here is only inside flowText.repaint and does not undo its cache handling. With Desktop: nothing redraws when idle, cheaper theme changes (#474) #489, a reflow here costs no re-shaping since cut is rebuilt from the kept measures.

Assisted-by: Claude Sonnet 5.5 low

🤖 Generated with Claude Code

@MopigamesYT MopigamesYT added bug Something isn't working desktop Desktop app (Linux, Windows) labels Nov 17, 2026
@MopigamesYT

Copy link
Copy Markdown
Member Author

Heads-up from testing the open PRs merged together: #477 changes repaint(changed recolour) to repaint(changed recolour, fontsChanged bool), and this PR's new test calls it with one argument (internal/ui/theme_switch_colours_test.go:36). With both merged, go vet ./internal/ui and the UI tests fail with not enough arguments in call to repaint. Whichever of the two merges second needs that call updated. #498 and #501 carry the same change, since they're stacked on #477.

@tpm28

tpm28 commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator

ci error

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working desktop Desktop app (Linux, Windows)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants