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: removing theme from cli.json does not revert to default theme #64420
In the TUI, changing or adding theme.name in cli.json applies live, but removing the theme entry does not revert the theme to the default (opencode) — the last explicitly applied theme stays, even after /reload.
Environment
opencode version: 2.3.0
OS: Windows 11 10.0.26300 (win32 x64)
Terminal: Windows Terminal
Shell: cmd.exe
Install/channel: latest (npm, @opencode/cli)
Active plugins: none
Reproduction
Start the TUI with no theme entry in ~/.config/opencode/cli.json (default theme shown).
Add "theme": { "name": "gruvbox" } → the theme changes live, no restart needed.
Remove the theme entry again → the TUI keeps the gruvbox colors.
Run /reload → the theme still stays gruvbox.
Set "theme": { "name": "opencode" } explicitly → the default look is applied immediately.
Verified repeatedly (gruvbox and nord as test themes), with the TUI window focused during each change.
Expected Behavior
Removing the theme entry (or forcing a reload with /reload) restores the default theme (opencode), since the setting is no longer present.
Actual Behavior
The theme is only re-applied when a value is present in the config; an absent value does not reset the currently displayed theme. Reverting to the default requires explicitly setting "theme": { "name": "opencode" } or restarting the TUI.
Additional Context
The cli.json file is read and hot-reloaded correctly (theme changes apply live), so this is not a config-loading issue.
Workaround: set "theme": { "name": "opencode" } explicitly, or restart the TUI.
Minor/harmless; logged for completeness. Observed on Windows; not tested on Linux.
Removed the theme entry again: the TUI stayed on gruvbox.
Ran /reload: the "Configuration reloaded" toast appeared, still gruvbox.
Set "theme": { "name": "opencode" } explicitly: the default theme came back right away.
The script below reproduces it. Until it is fixed, your workaround works: set "name": "opencode" explicitly, or restart the TUI.
recording.mp4
Reproduction script (drive.ts)
// Repro for anomalyco/opencode#64420: removing `theme` from cli.json does not revert to the default theme.import{Effect}from"effect"import{OpenCodeDriver}from"opencode-drive"import{mkdirSync,writeFileSync}from"node:fs"import{join}from"node:path"// Drive points OPENCODE_CONFIG_DIR at <artifacts>/files/.opencode, so this is the global cli.json.constwrite=(artifacts: string,cfg: object)=>Effect.sync(()=>{constdir=join(artifacts,"files",".opencode")mkdirSync(dir,{recursive: true})writeFileSync(join(dir,"cli.json"),JSON.stringify(cfg,null,2)+"\n")})exportdefaultOpenCodeDriver.use({
...(process.env.OC_DEV ? {opencode: {dev: process.env.OC_DEV}} : {}),tui: {recording: true,keypressOverlay: true},},({ ui, artifacts })=>Effect.gen(function*(){yield*write(artifacts,{})yield*Effect.sleep(3000)yield*ui.screenshot("1-default-no-theme")yield*write(artifacts,{theme: {name: "gruvbox"}})yield*Effect.sleep(4000)yield*ui.screenshot("2-gruvbox-added")yield*write(artifacts,{})yield*Effect.sleep(4000)yield*ui.screenshot("3-theme-removed")yield*ui.submit("/reload")yield*Effect.sleep(4000)yield*ui.screenshot("4-after-reload")yield*write(artifacts,{theme: {name: "opencode"}})yield*Effect.sleep(4000)yield*ui.screenshot("5-opencode-explicit")}),)
Run it with opencode-drive: opencode-drive run ./drive.ts. It drives opencode from your PATH; set OC_DEV to the path of an OpenCode checkout to run that from source instead.
The reactive theme effect returns early when theme.name disappears, while provider initialization already defaults to opencode. This focused patch applies that same fallback on updates (commit 0488d1cb157b5aae85047390d9b7b6d349a1d293, based on a9a35b4).
Automated macOS validation exercises the real ConfigProvider → ThemeProvider → rendered text/color path. Both removal cases fail on the base and pass with the patch; explicit theme changes and the pinned light-mode preference are covered. All 7 tests pass across 10 runs, 122 adjacent theme/config tests pass, and root bun run check passes all 35 tasks.
The full TUI suite hits an OpenTUI runtime-plugin import stack overflow, also reproduced with both changed files restored to the base; its candidate run ended in SIGKILL. Windows-native testing and hosted CI remain unverified. PR creation is still blocked by the account's existing CreatePullRequest permission error; the branch and patch are available for review.
Activity
opencodejr commentedon Nov 17, 2026
Thanks for the clear steps. I reproduced this on
@opencode/cli2.3.0, and it still happens on the latestdev(a9a35b4).What I did, with the TUI running (the recording and screenshots below show each step):
cli.json: defaultopencodetheme."theme": { "name": "gruvbox" }: gruvbox applied live.themeentry again: the TUI stayed on gruvbox./reload: the "Configuration reloaded" toast appeared, still gruvbox."theme": { "name": "opencode" }explicitly: the default theme came back right away.The script below reproduces it. Until it is fixed, your workaround works: set
"name": "opencode"explicitly, or restart the TUI.recording.mp4
Reproduction script (drive.ts)
Run it with opencode-drive:
opencode-drive run ./drive.ts. It drivesopencodefrom yourPATH; setOC_DEVto the path of an OpenCode checkout to run that from source instead.1052326311 commentedon Nov 17, 2026
The reactive theme effect returns early when
theme.namedisappears, while provider initialization already defaults toopencode. This focused patch applies that same fallback on updates (commit0488d1cb157b5aae85047390d9b7b6d349a1d293, based ona9a35b4).Automated macOS validation exercises the real ConfigProvider → ThemeProvider → rendered text/color path. Both removal cases fail on the base and pass with the patch; explicit theme changes and the pinned light-mode preference are covered. All 7 tests pass across 10 runs, 122 adjacent theme/config tests pass, and root
bun run checkpasses all 35 tasks.The full TUI suite hits an OpenTUI runtime-plugin import stack overflow, also reproduced with both changed files restored to the base; its candidate run ended in SIGKILL. Windows-native testing and hosted CI remain unverified. PR creation is still blocked by the account's existing CreatePullRequest permission error; the branch and patch are available for review.