Skip to content

feat(tui): implement model and provider theme auto-selection#24753

Open
zxmpg41 wants to merge 3 commits intoanomalyco:devfrom
zxmpg41:feat/model-provider-theme-selection
Open

feat(tui): implement model and provider theme auto-selection#24753
zxmpg41 wants to merge 3 commits intoanomalyco:devfrom
zxmpg41:feat/model-provider-theme-selection

Conversation

@zxmpg41
Copy link
Copy Markdown

@zxmpg41 zxmpg41 commented Apr 28, 2026

Issue for this PR

Closes #6631

Type of change

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

What does this PR do?

This PR adds the ability to automatically switch the TUI theme based on the currently active model or provider.

Sample configuration:

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "anthropic": {
      "theme": "gruvbox",
      "models": {
        "claude-sonnet-4.6": {
          "name": "Claude Sonnet 4.6"
        },
        "claude-opus-4.6": {
          "name": "Claude Opus 4.6",
		  "theme": "orng"
        },
      }
    }
  }
}

How did you verify your code works?

  • Wrote and passed new unit tests (bun test test/cli/tui/local.test.ts and bun test test/provider/provider.test.ts) that specifically test the fallback priorities.
  • Verified that configuring a theme on a provider successfully cascades to its models, unless explicitly overridden by a specific model's config.

Screenshots / recordings

opencode

Checklist

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

zxmpg41 added 3 commits April 27, 2026 22:51
This commit introduces test coverage for the provider and model theme configurations added in anomalyco#6631.

- Adds  config parsing validations to ensure that `model.theme` takes precedence and falls back to `undefined` rather than inheriting `provider.theme` at the model level.
- Refactors the theme resolution logic in `cli/cmd/tui/context/local.tsx` into a pure function `resolveThemeFallback`.
- Adds unit tests in `test/cli/tui/local.test.ts` to verify the UI fallback logic chain: `model.theme ?? provider.theme ?? tui.theme ?? 'opencode'`.
This adds documentation to the website to explain the new theme fallback mechanism introduced in anomalyco#6631.

- Adds a section in `themes.mdx` detailing how to auto-select a theme based on the active model or provider.
- Includes an example configuration for `opencode.json` showing `theme` applied to a provider and a specific model.
- Updates `config.mdx` to mention the fallback mechanism: `model theme -> provider theme -> tui theme -> default opencode theme`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Model-Provider Based Theme Auto-Selection

1 participant