summaryrefslogtreecommitdiff
path: root/powerlevel9k.zsh-theme
diff options
context:
space:
mode:
authorromkatv <roman.perepelitsa@gmail.com>2019-05-08 12:31:16 +0300
committerromkatv <roman.perepelitsa@gmail.com>2019-05-08 12:31:16 +0300
commit1d7c8368bc476cc4c547bbe66f69e3c912f6770b (patch)
treecb5e1b8483046e8c0c6a1ca407e1799d33e28184 /powerlevel9k.zsh-theme
parentb451b7a75821afedba6e9fa3c422e8eca9f8dedc (diff)
better terminal color mode detection
Diffstat (limited to 'powerlevel9k.zsh-theme')
-rwxr-xr-xpowerlevel9k.zsh-theme13
1 files changed, 5 insertions, 8 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme
index f7b1cf28..b5cf6b86 100755
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -2409,14 +2409,11 @@ _p9k_init() {
# Display a warning if the terminal does not support 256 colors.
if [[ $POWERLEVEL9K_IGNORE_TERM_COLORS == false ]]; then
- local n
- if { hash tput && n=$(tput colors) || hash echotc && n=$(echotc Co) } 2>/dev/null && (( n < 256 )); then
- if [[ -n $n && $n -lt 256 ]]; then
- print -P '%F{red}WARNING!%f Your terminal appears to support fewer than 256 colors!'
- print -P 'If your terminal supports 256 colors, please export the appropriate environment variable.'
- print -P 'In most terminal emulators, putting %F{blue}export TERM=xterm-256color%f at the top of your ~/.zshrc is sufficient.'
- print -P 'Set POWERLEVEL9K_IGNORE_TERM_COLORS=true to suppress this warning.'
- fi
+ if zmodload zsh/terminfo 2>/dev/null && (( $+terminfo[colors] && $terminfo[colors] < 256 )); then
+ print -P '%F{red}WARNING!%f Your terminal appears to support fewer than 256 colors!'
+ print -P 'If your terminal supports 256 colors, please export the appropriate environment variable.'
+ print -P 'In most terminal emulators, adding %F{blue}export TERM=xterm-256color%f to your %F{yellow}~/.zshrc%f is sufficient.'
+ print -P 'Set %F{blue}POWERLEVEL9K_IGNORE_TERM_COLORS=true%f to suppress this warning.'
fi
fi