From 4a31a22206102743e50ba34214b6663a5306b311 Mon Sep 17 00:00:00 2001 From: Von Random Date: Thu, 22 Dec 2016 12:42:21 +0300 Subject: [PATCH] more color tweaks for bash prompt --- bashplugins | 14 +++++++------- bashrc | 18 ++++++++++-------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/bashplugins b/bashplugins index ca01613..6158935 100644 --- a/bashplugins +++ b/bashplugins @@ -28,14 +28,14 @@ enable_git_prompt() GIT_PROMPT_SEPARATOR=" " GIT_PROMPT_START="[ ${git_prompt_username}${HOSTNAME}:${pbold}\w${preset} ]" GIT_PROMPT_THEME_NAME="Custom" - GIT_PROMPT_UNTRACKED="${pncyan}u" - GIT_PROMPT_CHANGED="${pnblue}+" - GIT_PROMPT_STAGED="${pnyellow}s" - GIT_PROMPT_CONFLICTS="${pnred}x" - GIT_PROMPT_STASHED="${pbmagenta}→" - GIT_PROMPT_CLEAN="${pngreen}." + GIT_PROMPT_UNTRACKED="${pcyan}u" + GIT_PROMPT_CHANGED="${pblue}+" + GIT_PROMPT_STAGED="${pyellow}s" + GIT_PROMPT_CONFLICTS="${pred}x" + GIT_PROMPT_STASHED="${ppurple}→" + GIT_PROMPT_CLEAN="${pgreen}." GIT_PROMPT_END_USER="\n${pbold}>${preset} " - GIT_PROMPT_END_ROOT="\n${pnred}>${preset} " + GIT_PROMPT_END_ROOT="\n${pred}>${preset} " . "${git_prompt_path}" fi } diff --git a/bashrc b/bashrc index 5bad20b..8d6d28f 100644 --- a/bashrc +++ b/bashrc @@ -25,11 +25,13 @@ is_exec() { [[ -x $(type -P ${1}) ]]; } # }}} # {{{ prompt color_number=0 -for color in 'black' 'red' 'green' 'yellow' 'blue' 'magenta' 'cyan' 'white'; do - eval "pn${color}='\[\e[38;5;$((color_number))m\]'" - eval "pb${color}='\[\e[38;5;$((color_number+8))m\]'" - eval "n${color}='\e[38;5;$((color_number))m'" - eval "b${color}='\e[38;5;$((color_number+8))m'" +# colors are named for the solarized palette +for color in \ + gray6 red green yellow blue magenta cyan gray1 \ + black orange gray5 gray4 gray3 purple gray2 white +do + eval "p${color}='\[\e[38;5;${color_number}m\]'" + eval "${color}='\e[38;5;${color_number}m'" (( color_number++ )) done unset color_number @@ -52,12 +54,12 @@ prompt_command() if [[ ${USER} == 'von' ]]; then prompt_user="" else - prompt_user="${pnred}\u${preset} " + prompt_user="${pred}\u${preset} " fi if ((UID)); then bang="${pbold}>" else - bang="${pnred}>" + bang="${pred}>" fi PS1="[ ${prompt_user}${HOSTNAME}:${pbold}\w${preset} ]${newline}${bang}${preset} " } @@ -149,5 +151,5 @@ plugins="${HOME}/.bashplugins" [[ -r "${plugins}" ]] && . "${plugins}" # we want to see exit code on error (it also has to be the last entry here) -trap 'printf "${nred}>>${reset} ${bold}exit${reset} ${nred}%s${reset}\n" "$?" >&2' ERR +trap 'printf "${nred}>>${reset} ${bold}exit${reset} ${red}%s${reset}\n" "$?" >&2' ERR # }}}