dotfiles

$HOME is where the <3 is
git clone git://git.alexkarle.com/dotfiles.git
Log | Files | Refs | Submodules | README

commit 9128bbc666644db42f210423e7539d1caa1e1f90 (patch)
parent bf41fba4c64e3d99a7a770c02209d4edc6f683f5
Author: Alex Karle <alex@karle.co>
Date:   Sat, 27 Jul 2019 14:33:57 -0400

bash: update prompt to be 8-color compatible

It's nice to get a colored prompt in the Virtual Console (outside of
tmux that is).

With TERM=linux, $(tput colors) eq 8, so this commit updates the prompt
to only use those 8 colors.

Diffstat:
Mbash/bash_prompt | 8++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/bash/bash_prompt b/bash/bash_prompt @@ -24,18 +24,18 @@ function get_error_code() { # Preferred Prompt: Fancy with colors from tput if tput setaf 1 &> /dev/null; then tput sgr0 - if [[ $(tput colors) -ge 16 ]] 2>/dev/null; then + if [[ $(tput colors) -ge 8 ]] 2>/dev/null; then SET_PREFERRED_PROMPT=1 RED="\[$(tput setaf 1)\]" MAGENTA="\[$(tput setaf 5)\]" - ORANGE="\[$(tput setaf 11)\]" + YELLOW="\[$(tput setaf 3)\]" GRAY="\[$(tput setaf 8)\]" - BLUE="\[$(tput setaf 12)\]" + BLUE="\[$(tput setaf 4)\]" BOLD="\[$(tput bold)\]" RESET="\[$(tput sgr0)\]" export PS1="$BOLD$RED\$(get_error_code)$BLUE\w $RESET$GRAY${ssh_text}\$(parse_git_branch)"$'\n'"$BOLD$MAGENTA\$ $RESET" - export PS2="$ORANGE> $RESET" + export PS2="$YELLOW> $RESET" fi fi