diff --git a/src/theme.rs b/src/theme.rs index fc90262..d19a554 100644 --- a/src/theme.rs +++ b/src/theme.rs @@ -97,6 +97,8 @@ pub struct Theme { pub editing_fg: Color, pub editing_title: Color, pub overlay_text: Color, + primary: Color, + secondary: Color, } impl Theme { @@ -122,8 +124,20 @@ impl Theme { editing_fg: secondary, editing_title: primary, overlay_text: primary, + primary, + secondary, } } + + #[must_use] + pub const fn primary_color(&self) -> Color { + self.primary + } + + #[must_use] + pub const fn secondary_color(&self) -> Color { + self.secondary + } } impl ThemeName { diff --git a/src/ui.rs b/src/ui.rs index b1f0a59..94e02ef 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -445,11 +445,16 @@ fn draw(f: &mut ratatui::Frame<'_>, app: &App) { f.render_widget(Clear, area); let items: Vec = ThemeName::ALL .iter() - .map(|t| { - ListItem::new(Span::styled( - t.display_name(), - Style::default().fg(theme.overlay_text), - )) + .enumerate() + .map(|(idx, t)| { + let item_theme = t.theme(); + let base_style = Style::default().fg(item_theme.primary_color()); + let style = if idx == app.theme_selected { + base_style.bg(item_theme.secondary_color()) + } else { + base_style + }; + ListItem::new(Span::styled(t.display_name(), style)) }) .collect(); let mut state = ListState::default(); @@ -463,12 +468,9 @@ fn draw(f: &mut ratatui::Frame<'_>, app: &App) { .border_type(BorderType::Plain) .border_style(Style::default().fg(theme.overlay_border)) .style(Style::default().bg(theme.overlay_bg)); - let list = List::new(items).block(block).highlight_style( - Style::default() - .bg(theme.overlay_highlight_bg) - .fg(theme.overlay_highlight_fg) - .add_modifier(Modifier::BOLD), - ); + let list = List::new(items) + .block(block) + .highlight_style(Style::default().add_modifier(Modifier::BOLD)); f.render_stateful_widget(list, area, &mut state); } else if matches!(app.mode(), InputMode::KeyCapture) { if let Some(action) = app.capture_action {