Skip to content

More robust theme autoreload#46

Open
ilyaZar wants to merge 1 commit intokitlangton:mainfrom
ilyaZar:fix-theme-palette-retry
Open

More robust theme autoreload#46
ilyaZar wants to merge 1 commit intokitlangton:mainfrom
ilyaZar:fix-theme-palette-retry

Conversation

@ilyaZar
Copy link
Copy Markdown
Contributor

@ilyaZar ilyaZar commented May 10, 2026

First, I appreciate if you find time to help me out on this, and I fully understand if that takes a bit more time !

The problem: it seems that theme auto-reload does not work consistently, as implemented by my PR #28

For my machine it works, otherwise I wouldnt have filed #28. Yet it does not work here basecamp/omarchy#5589

@kitlangton , if you find time, what would be yr take on the changes I propose here? I find it difficult to assess the nature of (a possible) race conditions if different machines/OS platforms send a sigusr2 signal and how to deal with that

I try to follow the same opentui path used in opencode’s tuitheme handling, which I roughly understand as:

opencode "pre-warms" he terminal palette and waits for theme mode before mounting some theme provider; then rsolves the system theme from renderer.getPalette({ size: 16 }) ; also clears opentui’s palette cache before rresolving system theme colors

Thats the files i looked at:

opencode/src/cli/cmd/tui/app.tsx
opencode/src/cli/cmd/tui/context/theme.tsx

The idea of the change here keeps ghui’s simpler SIGUSR2 mechanism from #28, but makes that path stricter: clear the cached palette before reads, wait for terminal to settle, retry palette reads, avoid replacing the current system theme when opentui/terminal justreturns incomplete palette data

does that make sense roughly ?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant