Skip to content

[FEATURE]: Add support for OpenTUI's new themeMode detection (Mode 2031) #13232

Description

@kavhnr

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

// existing — works as before
{ "theme": "opencode" }

// new — different themes per mode
{ "theme": { "light": "github", "dark": "catppuccin" } }

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

Activity

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

Metadata

Metadata

Assignees

Labels

discussionUsed for feature requests, proposals, ideas, etc. Open discussionopentuiThis relates to changes in v1.0, now that opencode uses opentui

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions