aboutsummaryrefslogtreecommitdiff
path: root/src/vcs.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/vcs.rs')
-rw-r--r--src/vcs.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/vcs.rs b/src/vcs.rs
index 26edf81..87c5517 100644
--- a/src/vcs.rs
+++ b/src/vcs.rs
@@ -27,12 +27,15 @@ pub fn vcs_status() -> Option<(colored::ColoredString, colored::ColoredString)>
27 }; 27 };
28 let mut branch; 28 let mut branch;
29 29
30 let branch_color = env::var("BRANCH_COLOR").unwrap_or("bright black".into());
31 let commit_color = env::var("COMMIT_COLOR").unwrap_or("bright black".into());
32
30 if reference.is_branch() { 33 if reference.is_branch() {
31 branch = format!("{}", reference.shorthand().unwrap()).bright_black(); 34 branch = format!("{}", reference.shorthand().unwrap()).color(branch_color);
32 } else { 35 } else {
33 let commit = reference.peel_to_commit().unwrap(); 36 let commit = reference.peel_to_commit().unwrap();
34 let id = commit.id(); 37 let id = commit.id();
35 branch = format!("{:.6}", id).bright_black(); 38 branch = format!("{:.6}", id).color(commit_color);
36 } 39 }
37 40
38 let mut repo_stat = "".white(); 41 let mut repo_stat = "".white();
@@ -58,7 +61,7 @@ pub fn vcs_status() -> Option<(colored::ColoredString, colored::ColoredString)>
58 let stat_char = env::var("GIT_INDEX_MODIFIED").unwrap_or("±".into()); 61 let stat_char = env::var("GIT_INDEX_MODIFIED").unwrap_or("±".into());
59 repo_stat = stat_char.color(&git_index_modified_color[..]); 62 repo_stat = stat_char.color(&git_index_modified_color[..]);
60 }, 63 },
61 // STATE: comitted (changes have been saved in the repo) 64 // STATE: committed (changes have been saved in the repo)
62 _ => { 65 _ => {
63 let stat_char = env::var("GIT_CLEAN").unwrap_or("·".into()); 66 let stat_char = env::var("GIT_CLEAN").unwrap_or("·".into());
64 repo_stat = stat_char.color(&git_clean_color[..]); 67 repo_stat = stat_char.color(&git_clean_color[..]);