Skip to content

fix(tui): revert to default theme when theme is removed from config - #65925

Merged
hearnadam merged 1 commit into
anomalyco:devfrom
hearnadam:theme-config-reset
Nov 23, 2026
Merged

hearnadam merged 1 commit into
anomalyco:devfrom
hearnadam:theme-config-reset

Conversation

@hearnadam

@hearnadam hearnadam commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #64420

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

When theme or theme.name is removed from cli.json, both the TypeScript TUI and Rust TUI previously returned early / skipped applying the change, leaving the previously configured theme active instead of reverting to the default opencode theme.

  • packages/tui/src/context/theme.tsx: falls back to "opencode" when config.theme?.name becomes unset, matching initial load.
  • packages/cli-rs/crates/tui/src/dialogs/settings.rs & packages/cli-rs/crates/ui/src/theme/state.rs: applies the default "opencode" theme when new.name becomes None, matching how mode already falls back to "system".

How did you verify your code works?

  • Added unit tests covering removing theme.name and removing the entire theme block in packages/tui/test/context/theme.test.tsx and packages/cli-rs/crates/tui/tests/all/config_live.rs.
  • Ran bun test test/context/theme.test.tsx, bun typecheck, oxlint, and prettier --check in packages/tui.
  • Ran cargo fmt --check and cargo test -p opencode-tui --test all config_live in packages/cli-rs.

Screenshots / recordings

TUI theme reloading from gruvbox to default opencode after removing theme from cli.json

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@hearnadam
hearnadam marked this pull request as ready for review November 23, 2026 23:38
@hearnadam
hearnadam merged commit 4d7951b into anomalyco:dev Nov 23, 2026
21 checks passed

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix works and looks sound. With the PR, removing theme or only theme.name from cli.json switches the TS TUI back to the default opencode theme. On the pre-merge code, the same drive script left gruvbox on screen after both removals. The new theme.test.tsx case fails before the change and passes after it, and tsc -b is clean. I couldn't run the Rust TUI changes here (no Rust toolchain), but the code reads correctly: like the TS TUI, it treats an empty or missing name as opencode, which matches the initial load.

Public API is unchanged: the theme.name config key is the same, and leaving it out now behaves the same way at runtime as it does at startup.

No concerns.

Before

After

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tui: removing theme from cli.json does not revert to default theme

1 participant