From bec55ac8a6ede5a6279fe222c60345e084369a95 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 18 Sep 2016 21:02:41 +1200 Subject: Tidy pdksh prompt colors, switch to yellow I'm using blue prompts for work machines --- pdksh/pdkshrc.d/prompt.pdksh | 57 ++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 31 deletions(-) diff --git a/pdksh/pdkshrc.d/prompt.pdksh b/pdksh/pdkshrc.d/prompt.pdksh index c446d3fe..a75618be 100644 --- a/pdksh/pdkshrc.d/prompt.pdksh +++ b/pdksh/pdkshrc.d/prompt.pdksh @@ -45,37 +45,32 @@ prompt() { # Decide prompt color formatting based on color availability typeset format - case $colors in - - # Check if we have non-bold bright green available - 256) - format=$( { - : "${PROMPT_COLOR:=12}" - tput AF "$PROMPT_COLOR" || - tput setaf "$PROMPT_COLOR" || - tput AF "$PROMPT_COLOR" 0 0 || - tput setaf "$PROMPT_COLOR" 0 0 - } 2>/dev/null ) - ;; - - # If we have only eight colors, use bold green - 8) - format=$( { - : "${PROMPT_COLOR:=4}" - tput AF "$PROMPT_COLOR" || - tput setaf "$PROMPT_COLOR" - tput md || tput bold - } 2>/dev/null ) - ;; - - # For all other terminals, we assume non-color (!), and we just - # use bold - *) - format=$( { - tput md || tput bold - } 2>/dev/null ) - ;; - esac + + # Check if we have non-bold bright yellow available + if ((colors >= 16)) ; then + format=$( { + : "${PROMPT_COLOR:=11}" + tput setaf "$PROMPT_COLOR" || + tput setaf "$PROMPT_COLOR" 0 0 || + tput AF "$PROMPT_COLOR" || + tput AF "$PROMPT_COLOR" 0 0 + } 2>/dev/null ) + + # If we have only eight colors, use bold yellow + elif ((colors >= 8)) ; then + format=$( { + : "${PROMPT_COLOR:=3}" + tput setaf "$PROMPT_COLOR" || + tput AF "$PROMPT_COLOR" + tput bold || tput md + } 2>/dev/null ) + + # Otherwise, we just try bold + else + format=$( { + tput bold || tput md + } 2>/dev/null ) + fi # String it all together PS1='\['"$format"'\]'"$PS1"'\['"$reset"'\] ' -- cgit v1.2.3