Refactor Git panel styling & status colors for consistency (#26951)

Jakub ČermÑk created

Closes #26847

Release Notes:

- Updated Git panel background to use panel_background instead of
ElevationIndex::Surface.bg(cx) for consistency with other panels.
- Removed redundant GitStatusColors struct from status.rs and refactored
to use existing theme colors.
- Adjusted Color enum mappings in color.rs to reference
version_control_* colors instead of status() for better alignment with
the theme system.
- Cleaned up unused or redundant code.

Change summary

crates/editor/src/items.rs        |  8 ++++----
crates/git_ui/src/git_panel.rs    |  8 ++++----
crates/theme/src/styles/status.rs | 20 --------------------
crates/ui/src/styles/color.rs     | 15 +++++++++++++++
4 files changed, 23 insertions(+), 28 deletions(-)

Detailed changes

crates/editor/src/items.rs πŸ”—

@@ -1673,13 +1673,13 @@ pub fn entry_diagnostic_aware_icon_decoration_and_color(
 pub fn entry_git_aware_label_color(git_status: GitSummary, ignored: bool, selected: bool) -> Color {
     let tracked = git_status.index + git_status.worktree;
     if ignored {
-        Color::Ignored
+        Color::VersionControlIgnored
     } else if git_status.conflict > 0 {
-        Color::Conflict
+        Color::VersionControlConflict
     } else if tracked.modified > 0 {
-        Color::Modified
+        Color::VersionControlModified
     } else if tracked.added > 0 || git_status.untracked > 0 {
-        Color::Created
+        Color::VersionControlAdded
     } else {
         entry_label_color(selected)
     }

crates/git_ui/src/git_panel.rs πŸ”—

@@ -3532,14 +3532,14 @@ impl GitPanel {
 
         let label_color = if status_style == StatusStyle::LabelColor {
             if has_conflict {
-                Color::Conflict
+                Color::VersionControlConflict
             } else if is_modified {
-                Color::Modified
+                Color::VersionControlModified
             } else if is_deleted {
                 // We don't want a bunch of red labels in the list
                 Color::Disabled
             } else {
-                Color::Created
+                Color::VersionControlAdded
             }
         } else {
             Color::Default
@@ -3808,7 +3808,7 @@ impl Render for GitPanel {
             }))
             .size_full()
             .overflow_hidden()
-            .bg(ElevationIndex::Surface.bg(cx))
+            .bg(cx.theme().colors().panel_background)
             .child(
                 v_flex()
                     .size_full()

crates/theme/src/styles/status.rs πŸ”—

@@ -86,15 +86,6 @@ pub struct DiagnosticColors {
     pub info: Hsla,
 }
 
-pub struct GitStatusColors {
-    pub created: Hsla,
-    pub deleted: Hsla,
-    pub modified: Hsla,
-    pub renamed: Hsla,
-    pub conflict: Hsla,
-    pub ignored: Hsla,
-}
-
 impl StatusColors {
     pub fn dark() -> Self {
         Self {
@@ -197,15 +188,4 @@ impl StatusColors {
             info: self.info,
         }
     }
-
-    pub fn git(&self) -> GitStatusColors {
-        GitStatusColors {
-            created: self.created,
-            deleted: self.deleted,
-            modified: self.modified,
-            renamed: self.renamed,
-            conflict: self.conflict,
-            ignored: self.ignored,
-        }
-    }
 }

crates/ui/src/styles/color.rs πŸ”—

@@ -58,6 +58,16 @@ pub enum Color {
     Selected,
     /// A color used to indicate a successful operation or status.
     Success,
+    /// A version control color used to indicate a newly added file or content in version control.
+    VersionControlAdded,
+    /// A version control color used to indicate conflicting changes that need resolution.
+    VersionControlConflict,
+    /// A version control color used to indicate a file or content that has been deleted in version control.
+    VersionControlDeleted,
+    /// A version control color used to indicate files or content that is being ignored by version control.
+    VersionControlIgnored,
+    /// A version control color used to indicate modified files or content in version control.
+    VersionControlModified,
     /// A color used to indicate a warning condition.
     Warning,
 }
@@ -84,6 +94,11 @@ impl Color {
             Color::Error => cx.theme().status().error,
             Color::Selected => cx.theme().colors().text_accent,
             Color::Success => cx.theme().status().success,
+            Color::VersionControlAdded => cx.theme().colors().version_control_added,
+            Color::VersionControlConflict => cx.theme().colors().version_control_conflict,
+            Color::VersionControlDeleted => cx.theme().colors().version_control_deleted,
+            Color::VersionControlIgnored => cx.theme().colors().version_control_ignored,
+            Color::VersionControlModified => cx.theme().colors().version_control_modified,
             Color::Warning => cx.theme().status().warning,
             Color::Custom(color) => *color,
         }