feat(themes): add 13 built-in color themes with theme picker.#3
feat(themes): add 13 built-in color themes with theme picker.#3
Conversation
- Add ColorTheme struct and COLOR_THEMES array with 13 presets (default, catppuccin-mocha, catppuccin-macchiato, dracula, tokyonight, gruvbox, nord, solarized-dark, onedark, rosepine, kanagawa, everforest, monokai) - Expand Theme struct with 100+ color fields for complete UI theming (syntax highlighting, diff panel, rebase mode, ref labels, etc.) - Add interactive theme picker popup with live preview and keyboard navigation - Persist selected theme to app state config - Replace all hardcoded color values with theme-aware colors
- Rename RefPickerItem/RefPickerAction to ListPickerItem/ListPickerAction for generality - Extract ListPickerCore struct to hold common picker state (items, selected, search_textarea, scroll_offset) - Consolidate RefPicker and ThemePicker to use ListPickerCore - Extract list_picker_display_idx() helper to compute display indices with category headers - Extract list_picker_visible_height() helper for consistent height calculation - Consolidate rendering logic into render_list_picker() function - Add search/filter support to ThemePicker for consistency - Remove redundant inline comments
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: db6149c071
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let mut state = self.config.app_state.clone(); | ||
| state.color_theme = Some(ct.id.to_string()); | ||
| let _ = state.save(&self.config.state_path); |
There was a problem hiding this comment.
Load latest AppState before saving chosen theme
The theme picker’s Enter handler saves color_theme by cloning self.config.app_state, which is only the startup snapshot. If a user changed persisted UI settings earlier in the same session (for example showCommandLog/showFileTree/diffLineWrap, which are saved via AppState::load+save), this write will overwrite those newer values with stale ones and silently revert preferences. Read the current state from disk before mutating color_theme so unrelated fields are preserved.
Useful? React with 👍 / 👎.
| open_theme_picker = true; | ||
| } | ||
| } | ||
| KeyCode::Down => { |
There was a problem hiding this comment.
Keep j/k navigation in help popup
This branch now handles only arrow keys, so j/k no longer move the selection in the help popup even though the popup hint still advertises j/k navigation. In practice, pressing j or k is treated as text input and modifies the search field, which is a behavioral regression from previous key handling and breaks expected vim-style navigation.
Useful? React with 👍 / 👎.
| pub fn active_theme(&self) -> crate::config::Theme { | ||
| crate::config::COLOR_THEMES | ||
| .get(self.current_theme_index) | ||
| .map(|ct| ct.to_theme()) | ||
| .unwrap_or_default() |
There was a problem hiding this comment.
Respect gui.theme overrides when computing active theme
active_theme() now returns only a built-in preset from COLOR_THEMES, and rendering paths use this result directly, so existing gui.theme overrides from config.yml (parsed by UserConfig::theme) are effectively ignored after this change. That removes previously working user customization behavior and introduces a backward-compatibility regression for users relying on custom border/selection color settings.
Useful? React with 👍 / 👎.
Separates state directory from config directory following XDG Base Directory specification. State files are now stored in XDG_STATE_HOME (defaults to ~/.local/state) instead of the config directory, improving compliance with system directory standards. Also refactors home_dir resolution to avoid duplication by extracting it once.
presets
(default, catppuccin-mocha, catppuccin-macchiato,
dracula, tokyonight,
gruvbox, nord, solarized-dark, onedark, rosepine,
kanagawa, everforest,
monokai)
complete UI theming
(syntax highlighting, diff panel, rebase mode, ref
labels, etc.)
and keyboard navigation
colors