Skip to content

Commit

Permalink
Made _agkozak_has_colors work with TERMCAP
Browse files Browse the repository at this point in the history
  • Loading branch information
agkozak committed Aug 23, 2018
1 parent 7c9568f commit b32072c
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions agkozak-zsh-prompt.plugin.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,18 @@ setopt PROMPT_SUBST NO_PROMPT_BANG
# AGKOZAK_HAS_COLORS
###########################################################
_agkozak_has_colors() {
typeset -g AGKOZAK_HAS_COLORS=${AGKOZAK_HAS_COLORS:-$(( $(tput colors) >= 8 ? 1 : 0 ))}
(( AGKOZAK_HAS_COLORS ))
if (( $+AGKOZAK_HAS_COLORS )); then
(( AGKOZAK_HAS_COLORS ))
else
local colors
if [[ $OSTYPE == (*bsd*|dragonfly*) ]]; then
colors=$(tput Co)
else
colors=$(tput colors)
fi
typeset -g AGKOZAK_HAS_COLORS=$(( colors >= 8 ? 1 : 0 ))
(( AGKOZAK_HAS_COLORS ))
fi
}

############################################################
Expand Down

0 comments on commit b32072c

Please sign in to comment.