From 3796c7abdb3711cd925f9486fd7e49542f015fbe Mon Sep 17 00:00:00 2001 From: JEEVITHA KANNAN K S Date: Tue, 1 Oct 2024 21:28:04 +0530 Subject: [PATCH] Add colors for nm cmds --- tui/src/state.rs | 18 ++++++++++++++++-- tui/src/theme.rs | 7 +++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/tui/src/state.rs b/tui/src/state.rs index a7ec0bb5..744758d2 100644 --- a/tui/src/state.rs +++ b/tui/src/state.rs @@ -315,7 +315,12 @@ impl AppState { let (indicator, style) = if is_selected { (self.theme.multi_select_icon(), Style::default().bold()) } else { - ("", Style::new()) + let ms_style = if self.multi_select && !node.multi_select { + Style::default().fg(self.theme.multi_select_disabled_color()) + } else { + Style::new() + }; + ("", ms_style) }; if *has_children { Line::from(format!( @@ -325,6 +330,7 @@ impl AppState { indicator )) .style(self.theme.dir_color()) + .patch_style(style) } else { Line::from(format!( "{} {} {}", @@ -342,13 +348,21 @@ impl AppState { |ListEntry { node, has_children, .. }| { + let ms_style = if self.multi_select && !node.multi_select { + Style::default().fg(self.theme.multi_select_disabled_color()) + } else { + Style::new() + }; if *has_children { - Line::from(" ").style(self.theme.dir_color()) + Line::from(" ") + .style(self.theme.dir_color()) + .patch_style(ms_style) } else { Line::from(format!("{} ", node.task_list)) .alignment(Alignment::Right) .style(self.theme.cmd_color()) .bold() + .patch_style(ms_style) } }, )); diff --git a/tui/src/theme.rs b/tui/src/theme.rs index 8337645a..d87e87ee 100644 --- a/tui/src/theme.rs +++ b/tui/src/theme.rs @@ -28,6 +28,13 @@ impl Theme { } } + pub fn multi_select_disabled_color(&self) -> Color { + match self { + Theme::Default => Color::DarkGray, + Theme::Compatible => Color::DarkGray, + } + } + pub fn tab_color(&self) -> Color { match self { Theme::Default => Color::Rgb(255, 255, 85),