From 9600337d8154ad733ffc052deb9537c1d1e4a6ff Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Sat, 23 Dec 2023 01:27:41 +0200 Subject: [PATCH] Properly color file labels in project panel --- crates/project_panel2/src/project_panel.rs | 13 +++++-------- crates/ui2/src/styles/color.rs | 2 ++ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/crates/project_panel2/src/project_panel.rs b/crates/project_panel2/src/project_panel.rs index 1259fc1d61..2966c55f79 100644 --- a/crates/project_panel2/src/project_panel.rs +++ b/crates/project_panel2/src/project_panel.rs @@ -1364,16 +1364,15 @@ impl ProjectPanel { .map_or(false, |selection| selection.entry_id == entry_id); let width = self.width.unwrap_or(px(0.)); - let theme = cx.theme(); let filename_text_color = details .git_status .as_ref() .map(|status| match status { - GitFileStatus::Added => theme.status().created, - GitFileStatus::Modified => theme.status().modified, - GitFileStatus::Conflict => theme.status().conflict, + GitFileStatus::Added => Color::Created, + GitFileStatus::Modified => Color::Modified, + GitFileStatus::Conflict => Color::Conflict, }) - .unwrap_or(theme.status().info); + .unwrap_or(Color::Default); let file_name = details.filename.clone(); let icon = details.icon.clone(); @@ -1407,9 +1406,7 @@ impl ProjectPanel { if let (Some(editor), true) = (Some(&self.filename_editor), show_editor) { div().h_full().w_full().child(editor.clone()) } else { - div() - .text_color(filename_text_color) - .child(Label::new(file_name)) + div().child(Label::new(file_name).color(filename_text_color)) } .ml_1(), ) diff --git a/crates/ui2/src/styles/color.rs b/crates/ui2/src/styles/color.rs index 0769558acb..977a26dedc 100644 --- a/crates/ui2/src/styles/color.rs +++ b/crates/ui2/src/styles/color.rs @@ -13,6 +13,7 @@ pub enum Color { Hidden, Info, Modified, + Conflict, Muted, Placeholder, Player(u32), @@ -28,6 +29,7 @@ impl Color { Color::Muted => cx.theme().colors().text_muted, Color::Created => cx.theme().status().created, Color::Modified => cx.theme().status().modified, + Color::Conflict => cx.theme().status().conflict, Color::Deleted => cx.theme().status().deleted, Color::Disabled => cx.theme().colors().text_disabled, Color::Hidden => cx.theme().status().hidden,