aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pdksh/pdkshrc.d/prompt.pdksh57
1 files 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"'\] '