You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
TUI dark/light mode does not follow Windows system theme #36252
On Windows 11 Terminal, when the user toggles the system dark/light mode (Settings > Personalization > Colors > Choose your mode), the terminal title bar changes colour but the terminal background colour (queried via OSC 11 \e]11;?\e\) does NOT change.
Since opencode's TUI derives its dark/light mode exclusively from terminalMode() — which reads the terminal background colour — the TUI never detects the system theme switch and stays on the wrong colour mode.
Steps to reproduce
Run opencode TUI on Windows 11 Terminal (Windows Terminal v1.20+)
Observe the TUI is in light mode (or dark mode)
Open Windows Settings → Personalization → Colors
Toggle "Choose your default app mode" between Light and Dark
The terminal title bar immediately reflects the change
The opencode TUI does NOT switch its colour mode
Expected behaviour
The TUI should follow the Windows system theme when running on Windows 11 Terminal, just like it follows the terminal background colour on other platforms/terminals.
System info
Windows 11
Windows Terminal 1.20+
opencode dev branch
Suggested fix
Read the Windows registry key HKCU\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize\AppsUseLightTheme as an additional signal. On Windows Terminal the background colour is not a reliable indicator of the system theme because the title bar and buffer background are decoupled.
Additional environment worth covering: the same stale-mode behavior reproduces when opencode runs inside a terminal multiplexer that caches and replays the host palette (herdr 0.8.0), even on macOS.
Mechanism there: opencode's system theme only refreshes on a \e[?997 color-scheme report or SIGUSR2 (packages/tui/src/context/theme.tsxresolveSystemTheme/refreshSystemTheme). The multiplexer only forwards ?997 when its host terminal emits one, and it additionally answers OSC 10/11/4 queries itself from a cached host_terminal_theme. So if the outer terminal doesn't emit ?997 (e.g. Terminal.app), the palette detection result stays cached at first paint and the theme never flips — the multiplexer-side equivalent of the Windows 11 title-bar/background decoupling described here.
This parallels #42635 (filed from the same repro inside herdr). A focus-triggered or periodic getPalette() re-query would address both.
Activity
CripWal commentedon Aug 14, 2026
Additional environment worth covering: the same stale-mode behavior reproduces when opencode runs inside a terminal multiplexer that caches and replays the host palette (herdr 0.8.0), even on macOS.
Mechanism there: opencode's
systemtheme only refreshes on a\e[?997color-scheme report or SIGUSR2 (packages/tui/src/context/theme.tsxresolveSystemTheme/refreshSystemTheme). The multiplexer only forwards?997when its host terminal emits one, and it additionally answers OSC 10/11/4 queries itself from a cachedhost_terminal_theme. So if the outer terminal doesn't emit?997(e.g. Terminal.app), the palette detection result stays cached at first paint and the theme never flips — the multiplexer-side equivalent of the Windows 11 title-bar/background decoupling described here.This parallels #42635 (filed from the same repro inside herdr). A focus-triggered or periodic
getPalette()re-query would address both.github-actions commentedon Oct 14, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.