tui: make theme configurable via CLI settings#573
Open
adityavkk wants to merge 1 commit intoOpenHands:mainfrom
Open
tui: make theme configurable via CLI settings#573adityavkk wants to merge 1 commit intoOpenHands:mainfrom
adityavkk wants to merge 1 commit intoOpenHands:mainfrom
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The TUI theme is hardcoded to
"openhands"intextual_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
themefield toCliSettings(persisted in~/.openhands/cli_config.json) so users can set their preferred Textual theme. The default remains"openhands"for full backward compatibility.Changes
openhands_cli/stores/cli_settings.py: Addedtheme: str = "openhands"field with afield_validatorthat checks the value against Textual'sBUILTIN_THEMESplus"openhands". ExportedVALID_THEMESset.openhands_cli/tui/textual_app.py: Changedself.theme = "openhands"toself.theme = cli_settings.theme, reading from the already-loadedCliSettings. The customOPENHANDS_THEMEis still always registered.openhands_cli/tui/modals/settings/components/cli_settings_tab.py: Added aSelectwidget for theme selection in the CLI3.openhands_cli/tui/modals/settings/components/cli_settings_tab.py: Added aSelectwidget for theme selection in the CLI3.openhands_cli/tui/modals/settings/components/cli_settings_tab.py: Added aSelectwidging3. **open_settings.py: Added tests for theme default value, valid/invalid theme validation,VALID_THEMEScontents, 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
PR Checklist
make lintmake testmake test-snapshots— snapshots need updating for the new control