Просмотр исходного кода

Merge pull request #451 from MartinFillon/add-git-repo-colors

feat(colors): adding the possibility to change git-repos colors
Christina Sørensen 2 лет назад
Родитель
Сommit
ae6eb5a9d7
2 измененных файлов с 21 добавлено и 4 удалено
  1. 12 0
      man/eza_colors.5.md
  2. 9 4
      src/theme/ui_styles.rs

+ 12 - 0
man/eza_colors.5.md

@@ -210,6 +210,18 @@ LIST OF CODES
 `gc`
 : a conflicted flag in Git
 
+`Gm`
+: main branch of repo
+
+`Go`
+: other branch of repo
+
+`Gc`
+: clean branch of repo
+
+`Gd`
+: dirty branch of repo
+
 `xx`
 : “punctuation”, including many background UI elements
 

+ 9 - 4
src/theme/ui_styles.rs

@@ -119,10 +119,10 @@ pub struct Git {
 #[rustfmt::skip]
 #[derive(Clone, Copy, Debug, Default, PartialEq)]
 pub struct GitRepo {
-    pub branch_main: Style,
-    pub branch_other: Style,
-    pub git_clean: Style,
-    pub git_dirty: Style,
+    pub branch_main: Style,  //Gm
+    pub branch_other: Style, //Go
+    pub git_clean: Style,    //Gc
+    pub git_dirty: Style,    //Gd
 }
 
 #[derive(Clone, Copy, Debug, Default, PartialEq)]
@@ -241,6 +241,11 @@ impl UiStyles {
             "gi" => self.git.ignored                    = pair.to_style(),
             "gc" => self.git.conflicted                 = pair.to_style(),
 
+            "Gm" => self.git_repo.branch_main           = pair.to_style(),
+            "Go" => self.git_repo.branch_other          = pair.to_style(),
+            "Gc" => self.git_repo.git_clean             = pair.to_style(),
+            "Gd" => self.git_repo.git_dirty             = pair.to_style(),
+
             "xx" => self.punctuation                    = pair.to_style(),
             "da" => self.date                           = pair.to_style(),
             "in" => self.inode                          = pair.to_style(),