From 1c00e93525940d6d1e1a525185927909de30a146 Mon Sep 17 00:00:00 2001 From: Amir Yalon Date: Tue, 28 Jul 2009 22:54:51 +0800 Subject: Add control over color of user name. Signed-off-by: Leonid Volnitsky --- git-prompt.conf | 1 + git-prompt.sh | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/git-prompt.conf b/git-prompt.conf index a49221e..503ba94 100644 --- a/git-prompt.conf +++ b/git-prompt.conf @@ -43,6 +43,7 @@ # if [ 0`tput colors` -ge 8 ]; then # if terminal supports colors # dir_color=CYAN # rc_color=red + # user_id_color=blue # root_id_color=magenta # else # B/W terminal # dir_color=bw_bold diff --git a/git-prompt.sh b/git-prompt.sh index 8b3f812..f4bc46e 100755 --- a/git-prompt.sh +++ b/git-prompt.sh @@ -6,7 +6,7 @@ ##### read config file if any. - unset dir_color rc_color root_id_color init_vcs_color clean_vcs_color + unset dir_color rc_color user_id_color root_id_color init_vcs_color clean_vcs_color unset modified_vcs_color added_vcs_color addmoded_vcs_color untracked_vcs_color op_vcs_color detached_vcs_color conf=git-prompt.conf; [[ -r $conf ]] && . $conf @@ -28,6 +28,7 @@ if [ 0`tput colors` -ge 8 ]; then # if terminal supports colors dir_color=${dir_color:-CYAN} rc_color=${rc_color:-red} + user_id_color=${user_id_color:-blue} root_id_color=${root_id_color:-magenta} else # only B/W dir_color=${dir_color:-bw_bold} @@ -262,6 +263,7 @@ set_shell_label() { dir_color=${!dir_color} rc_color=${!rc_color} + user_id_color=${!user_id_color} root_id_color=${!root_id_color} ########################################################### HOST @@ -299,7 +301,7 @@ set_shell_label() { if [[ -n $id || -n $host ]] ; then [[ -n $id && -n $host ]] && at='@' || at='' - color_who_where="${id}$at${host:+$host_color$host}${tty:+ $tty}" + color_who_where="${id}${host:+$host_color$at$host}${tty:+ $tty}" plain_who_where="${id}$at$host" # add trailing " " @@ -307,9 +309,10 @@ set_shell_label() { plain_who_where="$plain_who_where " # if root then make it root_color - if [ "$id" == "root" ] ; then - color_who_where="$root_id_color$color_who_where$colors_reset" + if [ "$id" == "root" ] ; then + user_id_color=$root_id_color fi + color_who_where="$user_id_color$color_who_where$colors_reset" else color_who_where='' fi -- cgit v1.2.3