-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Description
Feature hasn't been suggested before.
- I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
OpenCode detects dark/light once at startup via OSC 11 luminance and never reacts to changes. Users who switch appearance mid-session have to restart or manually toggle.
We added Mode 2031 dark/light theme detection to OpenTUI in opentui#657 (shipped in v0.1.78, included in v0.1.79 which OpenCode is already on via #13036). The renderer.themeMode / renderer.on("theme_mode", ...) API is available but OpenCode doesn't use it yet.
This proposes integrating that API into OpenCode's theme system:
1. Tri-state mode (auto / dark / light) replacing the binary toggle. auto follows OS via Mode 2031, falling back to OSC 11 on unsupported terminals. dark / light are manual overrides.
2. Per-mode theme config (backward compatible):
3. Appearance selector in the existing theme dialog — ←/→ arrow keys cycle modes, clickable, reverts on cancel.
Mode 2031 is the same approach used by Neovim and Helix. Terminal-native, event-driven, zero overhead. Supported on Ghostty 1.0+, kitty 0.38.1+, Contour 0.4+, VTE 0.82+. Unsupported terminals silently ignore the sequences.
31 of 33 built-in themes have { dark, light } color variants and work out of the box. The two without (aura, ayu) are unaffected.
Previously requested via different approaches (this uses OpenTUI's new themeMode, which none of them had):
- Support dark/light mode os sync #480 — dark/light mode OS sync
- [FEATURE]: Light/Dark mode auto-switching #9697 — light/dark mode auto-switching
- Different theme for light and dark mode #3244 — different theme for light and dark mode
- Use dark mode theme when launching from NeoVim's terminal with light mode #11151 — dark mode in NeoVim's light terminal (manual override)
- Updating system theme requires hard reboot to fix #1587 — system theme requires hard reboot
- [BUG/FEATURE] Light Mode doesn't work in Zellij #4464 — light mode in Zellij (manual mode selector)