Skip to content

tui: make theme configurable via CLI settings#573

Open
adityavkk wants to merge 1 commit intoOpenHands:mainfrom
adityavkk:feat/configurable-theme
Open

tui: make theme configurable via CLI settings#573
adityavkk wants to merge 1 commit intoOpenHands:mainfrom
adityavkk:feat/configurable-theme

Conversation

@adityavkk
Copy link

Problem

The TUI theme is hardcoded to "openhands" in textual_app.py. There is no way for users to customize the color theme, even though Textual ships with many built-in themes (dracula, nord, catppuccin-mocha, tokyo-night, etc.).

Solution

Add a theme field to CliSettings (persisted in ~/.openhands/cli_config.json) so users can set their preferred Textual theme. The default remains "openhands" for full backward compatibility.

Changes

  1. openhands_cli/stores/cli_settings.py: Added theme: str = "openhands" field with a field_validator that checks the value against Textual's BUILTIN_THEMES plus "openhands". Exported VALID_THEMES set.

  2. openhands_cli/tui/textual_app.py: Changed self.theme = "openhands" to self.theme = cli_settings.theme, reading from the already-loaded CliSettings. The custom OPENHANDS_THEME is still always registered.

  3. openhands_cli/tui/modals/settings/components/cli_settings_tab.py: Added a Select widget for theme selection in the CLI3. openhands_cli/tui/modals/settings/components/cli_settings_tab.py: Added a Select widget for theme selection in the CLI3. openhands_cli/tui/modals/settings/components/cli_settings_tab.py: Added a Select widging3. **open_settings.py: Added tests for theme default value, valid/invalid theme validation, VALID_THEMES contents, save/load roundtrip, and updated the JSON format assertion.

    • tests/tui/modals/settings/t - testttings_tab.py: Added tests for theme selector rendering (default and custom values), get_updated_fields()` reflecting theme changes, and updated the managed-fields assertion.

Verification

make lint   # All checks passed
make test   # 1282 passed, 5 warnings (pre-existing)

Note: Snapshot tests (make test-snapshots) will need updating since the CLI settings tab now includes the new theme selector widget. Not run here as they require a specific environment.

PR Checklist

  • Scope is minimal and focused on one change
  • Tests added/updated for behavior changes
  • make lint
  • make test
  • (TUI touched) make test-snapshots — snapshots need updating for the new control
  • PR description includes: what changed, why, commands run

Add a 'theme' field to CliSettings (persisted in ~/.openhands/cli_config.json)
so users can choose their preferred Textual TUI theme. The default remains
'openhands' for backward compatibility.

Changes:
- Add theme field with validator to CliSettings (validates against Textual
  built-in themes + 'openhands')
- Read theme from cli_settings in OpenHandsApp instead of hardcoding
- Add theme Select widget to CliSettingsTab UI
- Add tests for validation, defaults, roundtrip, and UI rendering

Co-authored-by: openhands <openhands@all-hands.dev>
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.

1 participant