anomalyco / anomalyco/opencode

TUI system theme never refreshes terminal palette without a ?997 report (stale inside herdr)

Open
#42,635 2 comments 2 reactions 1 assignee View on GitHub

@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:

  1. Host terminal dark → OpenCode system theme renders dark.
  2. Host terminal switched to a light profile, Terminal window refocused.
  3. OpenCode system theme stays dark indefinitely; no ?997 report 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
  1. tui.json: { "theme": "system" }.
  2. Run opencode inside a herdr pane with a dark host terminal; confirm dark system theme.
  3. Switch the host terminal to a light profile and refocus the window.
  4. Observe the system theme 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.