From 3c7b0841158b23be74f796c84880ec01a91cc5ad Mon Sep 17 00:00:00 2001 From: Michael Allen Date: Sun, 30 Aug 2015 13:25:03 +0100 Subject: Make zsh remote commit colors configurable --- radar-base.sh | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'radar-base.sh') diff --git a/radar-base.sh b/radar-base.sh index d019629..7d5db56 100755 --- a/radar-base.sh +++ b/radar-base.sh @@ -4,6 +4,15 @@ dot_git="" cwd="" remote="" +prepare_zsh_colors() { + ZSH_COLOR_REMOTE_AHEAD="${GIT_RADAR_COLOR_ZSH_REMOTE_AHEAD:-$fg_bold[green]}" + ZSH_COLOR_REMOTE_BEHIND="${GIT_RADAR_COLOR_ZSH_REMOTE_BEHIND:-$fg_bold[red]}" + ZSH_COLOR_REMOTE_DIVERGED="${GIT_RADAR_COLOR_ZSH_REMOTE_DIVERGED:-$fg_bold[yellow]}" + ZSH_COLOR_REMOTE_NOT_UPSTREAM="${GIT_RADAR_COLOR_ZSH_REMOTE_NOT_UPSTREAM:-$fg_bold[red]}" + + ZSH_RESET_COLOR="${GIT_RADAR_COLOR_ZSH_RESET:-$reset_color}" +} + in_current_dir() { local wd="$(pwd)" if [[ "$wd" == $cwd ]]; then @@ -448,11 +457,13 @@ bash_color_remote_commits() { } zsh_color_remote_commits() { + prepare_zsh_colors + local remote_master="$(printf '\xF0\x9D\x98\xAE')" # an italic m to represent master - local green_ahead_arrow="%{$fg_bold[green]%}←%{$reset_color%}" - local red_behind_arrow="%{$fg_bold[red]%}→%{$reset_color%}" - local yellow_diverged_arrow="%{$fg_bold[yellow]%}⇄%{$reset_color%}" - local not_upstream="%{$fg_bold[red]%}⚡%{$reset_color%}" + local green_ahead_arrow="%{$ZSH_COLOR_REMOTE_AHEAD%}←%{$ZSH_RESET_COLOR%}" + local red_behind_arrow="%{$ZSH_COLOR_REMOTE_BEHIND%}→%{$ZSH_RESET_COLOR%}" + local yellow_diverged_arrow="%{$ZSH_COLOR_REMOTE_DIVERGED%}⇄%{$ZSH_RESET_COLOR%}" + local not_upstream="%{$ZSH_COLOR_REMOTE_NOT_UPSTREAM%}⚡%{$ZSH_RESET_COLOR%}" if remote_branch="$(remote_branch_name)"; then remote_ahead="$(remote_ahead_of_master "$remote_branch")" -- cgit v1.2.3