Skip to content

Commit 2c531b4

Browse files
committed
Rewrote _agkozak_has_colors
1 parent c39c0b1 commit 2c531b4

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

agkozak-zsh-prompt.plugin.zsh

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -101,17 +101,16 @@ setopt PROMPT_SUBST NO_PROMPT_BANG
101101
###########################################################
102102
_agkozak_has_colors() {
103103
if (( $+AGKOZAK_HAS_COLORS )); then
104-
(( AGKOZAK_HAS_COLORS ))
104+
:
105105
else
106106
local colors
107-
if [[ $OSTYPE == (*bsd*|dragonfly*) ]]; then
108-
colors=$(tput Co)
109-
else
110-
colors=$(tput colors)
111-
fi
112-
typeset -g AGKOZAK_HAS_COLORS=$(( colors >= 8 ? 1 : 0 ))
113-
(( AGKOZAK_HAS_COLORS ))
107+
case $OSTYPE in
108+
*bsd*|dragonfly*) colors=$(tput Co) ;;
109+
*) colors=$(tput colors) ;;
110+
esac
111+
typeset -g AGKOZAK_HAS_COLORS=$(( colors >= 8 ))
114112
fi
113+
(( AGKOZAK_HAS_COLORS ))
115114
}
116115

117116
############################################################

0 commit comments

Comments
 (0)