From 9720fd01fc53656333684c4aade5108402851b22 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sat, 31 Aug 2024 19:32:56 +0100 Subject: [PATCH] feat(tui): hightlight repo alias in red when in alert --- crates/cli/src/tui/components/repo/identity.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/crates/cli/src/tui/components/repo/identity.rs b/crates/cli/src/tui/components/repo/identity.rs index f5dc5352..2ea2998c 100644 --- a/crates/cli/src/tui/components/repo/identity.rs +++ b/crates/cli/src/tui/components/repo/identity.rs @@ -36,11 +36,16 @@ impl<'a> Identity<'a> { impl<'a> Identity<'a> { fn spans(self) -> Vec> { let label = self.label; - let repo_alias = self.repo_alias; + let repo_alias = Span::from(self.repo_alias.to_string()).style(if self.alert.is_some() { + Style::default().fg(Color::Black).bg(Color::Red) + } else { + Style::default().fg(Color::Cyan).bg(Color::Black) + }); let alert = self .alert .map_or(String::new(), |a| format!("{a} ")) - .fg(Color::Red); + .fg(Color::Black) + .bg(Color::Red); let message = self.message; let main = self .repo_branches @@ -56,7 +61,7 @@ impl<'a> Identity<'a> { .map_or_else(|| "_".to_string(), |b| b.to_string()); vec![ " ".into(), - Span::from(repo_alias.to_string()).style(Style::default().fg(Color::Blue)), + repo_alias, format!(" ({label}) ").into(), alert, format!("({main}/{next}/{dev}) [").into(),