Skip to content

Commit

Permalink
Rewrote _agkozak_has_colors
Browse files Browse the repository at this point in the history
  • Loading branch information
agkozak committed Aug 24, 2018
1 parent c39c0b1 commit 2c531b4
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions agkozak-zsh-prompt.plugin.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -101,17 +101,16 @@ setopt PROMPT_SUBST NO_PROMPT_BANG
###########################################################
_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 ))
case $OSTYPE in
*bsd*|dragonfly*) colors=$(tput Co) ;;
*) colors=$(tput colors) ;;
esac
typeset -g AGKOZAK_HAS_COLORS=$(( colors >= 8 ))
fi
(( AGKOZAK_HAS_COLORS ))
}

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

0 comments on commit 2c531b4

Please sign in to comment.