anomalyco / anomalyco/opencode
TUI system theme never refreshes terminal palette without a ?997 report (stale inside herdr)
@simonklee is already working on this.
Since Aug 14, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
When OpenCode's TUI runs inside a terminal multiplexer that caches and replays the host terminal's color scheme (herdr), the system theme never re-detects the palette when the host appearance changes. The palette is only refreshed on a \e[?997 color-scheme report or SIGUSR2; there is no re-query on window focus or any manual refresh command.
Reproduced: with ~/.config/opencode/tui.json set to {"theme": "system"} inside herdr on macOS:
- Host terminal dark → OpenCode
systemtheme renders dark. - Host terminal switched to a light profile, Terminal window refocused.
- OpenCode
systemtheme stays dark indefinitely; no?997report arrives from the host (Terminal.app doesn't emit one) and nothing triggers a re-query.
The relevant code only refreshes on CliRenderEvents.THEME_MODE / the ?997 handler / SIGUSR2 (packages/tui/src/context/theme.tsx resolveSystemTheme/refreshSystemTheme, plus renderer.getPalette in packages/core/src/renderer.ts).
Plugins
None relevant. Running as opencode TUI inside herdr.
OpenCode version
1.18.18
Steps to reproduce
tui.json:{ "theme": "system" }.- Run
opencodeinside a herdr pane with a dark host terminal; confirm darksystemtheme. - Switch the host terminal to a light profile and refocus the window.
- Observe the
systemtheme stays dark; it never refreshes.
Screenshot and/or share link
N/A
Operating System
macOS 26.5.2
Terminal
Terminal.app, inside herdr 0.8.0
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.