Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added parameters for colouring the wrapper portion of the status git:() #64

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,18 @@ All these values should be set using a the correct colour code for your
terminal. You should also choose the colour code based on what shell you are
using. There is a way to support [colouring multiple shells using rc files](#setting-an-rc-file).

##### Colouring the Wrapper part
**GIT_RADAR_COLOR_GIT_WRAPPER='[colour code]'**
```
git:(my-branch)
^^^^^ ^
```
The colour to use for the wrapper surrounding git status information

It is unset by
`GIT_RADAR_COLOR_WRAPPER_RESET` which you can set if you want a different
background colour to return to.

##### Colouring the Branch part

**GIT_RADAR_COLOR_BRANCH='[colour code]'**
Expand Down
4 changes: 2 additions & 2 deletions prompt.bash
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ source "$dot/radar-base.sh"

if is_repo; then
prepare_bash_colors
printf " \x01\033[1;30m\x02git:(\x01\033[0m\x02"
printf "${COLOR_GIT_WRAPPER}git:(${RESET_COLOR_WRAPPER}"
if show_remote_status $args; then
color_remote_commits
fi
readable_branch_name
color_local_commits
printf "\x01\033[1;30m\x02)\x01\033[0m\x02"
printf "${COLOR_GIT_WRAPPER})${RESET_COLOR_WRAPPER}"
color_changes_status
fi
4 changes: 2 additions & 2 deletions prompt.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ if is_repo; then
autoload colors && colors

prepare_zsh_colors
printf '%s' "%{$fg_bold[black]%} git:(%{$reset_color%}"
printf '%s' "${COLOR_GIT_WRAPPER}git:(${RESET_COLOR_WRAPPER}"
if show_remote_status $args; then
color_remote_commits
fi
readable_branch_name
color_local_commits
printf '%s' "%{$fg_bold[black]%})%{$reset_color%}"
printf '%s' "${COLOR_GIT_WRAPPER})${RESET_COLOR_WRAPPER}"
color_changes_status
fi
6 changes: 6 additions & 0 deletions radar-base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ prepare_bash_colors() {

PRINT_F_OPTION=""

COLOR_GIT_WRAPPER="\x01${GIT_RADAR_GIT_WRAPPER:-"\\033[1;30m"}\x02"

COLOR_REMOTE_AHEAD="\x01${GIT_RADAR_COLOR_REMOTE_AHEAD:-"\\033[1;32m"}\x02"
COLOR_REMOTE_BEHIND="\x01${GIT_RADAR_COLOR_REMOTE_BEHIND:-"\\033[1;31m"}\x02"
COLOR_REMOTE_DIVERGED="\x01${GIT_RADAR_COLOR_REMOTE_DIVERGED:-"\\033[1;33m"}\x02"
Expand All @@ -31,6 +33,7 @@ prepare_bash_colors() {
COLOR_BRANCH="\x01${GIT_RADAR_COLOR_BRANCH:-"\\033[0m"}\x02"
MASTER_SYMBOL="${GIT_RADAR_MASTER_SYMBOL:-"\\x01\\033[0m\\x02\\xF0\\x9D\\x98\\xAE\\x01\\033[0m\\x02"}"

RESET_COLOR_WRAPPER="\x01${GIT_RADAR_COLOR_WRAPPER_RESET:-"\\033[0m"}\x02"
RESET_COLOR_LOCAL="\x01${GIT_RADAR_COLOR_LOCAL_RESET:-"\\033[0m"}\x02"
RESET_COLOR_REMOTE="\x01${GIT_RADAR_COLOR_REMOTE_RESET:-"\\033[0m"}\x02"
RESET_COLOR_CHANGES="\x01${GIT_RADAR_COLOR_CHANGES_RESET:-"\\033[0m"}\x02"
Expand All @@ -46,6 +49,8 @@ prepare_zsh_colors() {

PRINT_F_OPTION="%s"

COLOR_GIT_WRAPPER="%{${GIT_RADAR_COLOR_GIT_WRAPPER:-$fg_bold[black]}%}"

COLOR_REMOTE_AHEAD="%{${GIT_RADAR_COLOR_REMOTE_AHEAD:-$fg_bold[green]}%}"
COLOR_REMOTE_BEHIND="%{${GIT_RADAR_COLOR_REMOTE_BEHIND:-$fg_bold[red]}%}"
COLOR_REMOTE_DIVERGED="%{${GIT_RADAR_COLOR_REMOTE_DIVERGED:-$fg_bold[yellow]}%}"
Expand All @@ -65,6 +70,7 @@ prepare_zsh_colors() {
COLOR_BRANCH="%{${GIT_RADAR_COLOR_BRANCH:-$reset_color}%}"
MASTER_SYMBOL="${GIT_RADAR_MASTER_SYMBOL:-"%{$reset_color%}$italic_m%{$reset_color%}"}"

RESET_COLOR_WRAPPER="%{${GIT_RADAR_COLOR_WRAPPER_RESET:-$reset_color}%}"
RESET_COLOR_LOCAL="%{${GIT_RADAR_COLOR_LOCAL_RESET:-$reset_color}%}"
RESET_COLOR_REMOTE="%{${GIT_RADAR_COLOR_REMOTE_RESET:-$reset_color}%}"
RESET_COLOR_CHANGES="%{${GIT_RADAR_COLOR_CHANGES_RESET:-$reset_color}%}"
Expand Down