diff options
author | Marc Cornellà <marc.cornella@live.com> | 2018-08-20 17:45:36 +0200 |
---|---|---|
committer | Marc Cornellà <marc.cornella@live.com> | 2018-08-20 17:45:36 +0200 |
commit | 4774bc62d5e1799ff531f2713f4a8cb493a406a1 (patch) | |
tree | b2d50a8b5c80feb52b51462d8ab1116ec521d678 /themes | |
parent | 1d26e2ab6f0b57ae8599d59e120df2aea1f125f3 (diff) | |
download | zsh-4774bc62d5e1799ff531f2713f4a8cb493a406a1.tar.gz zsh-4774bc62d5e1799ff531f2713f4a8cb493a406a1.tar.bz2 zsh-4774bc62d5e1799ff531f2713f4a8cb493a406a1.zip |
trapd00r: look for 256-color support, not $DISPLAY
Checking if the terminal supports 256 colors is better suited for
our purpose. Checking if `$DISPLAY` is set doesn't tell us if our
colors will be displayed correctly.
Diffstat (limited to 'themes')
-rwxr-xr-x | themes/trapd00r.zsh-theme | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/themes/trapd00r.zsh-theme b/themes/trapd00r.zsh-theme index 2feca08b9..51d5387e0 100755 --- a/themes/trapd00r.zsh-theme +++ b/themes/trapd00r.zsh-theme @@ -38,6 +38,9 @@ local c13=$(printf "\e[38;5;196m\e[1m") zsh_path() { + local colors + colors=$(echoti colors) + local -A yellow yellow=( 1 '%F{228}' 2 '%F{222}' 3 '%F{192}' 4 '%F{186}' @@ -51,7 +54,7 @@ zsh_path() { for c (${(s::)PWD}); do if [[ $c = "/" ]]; then if [[ $i -eq 1 ]]; then - if [[ -n "$DISPLAY" ]]; then + if [[ $colors -ge 256 ]]; then print -Pn '%F{065}%B /%b%f' else print -Pn '\e[31;1m /%f' @@ -60,14 +63,14 @@ zsh_path() { continue fi - if [[ -n "$DISPLAY" ]]; then + if [[ $colors -ge 256 ]]; then print -Pn "${yellow[$i]:-%f} » %f" else print -Pn "%F{yellow} > %f" fi (( i += 6 )) else - if [[ -n "$DISPLAY" ]]; then + if [[ $colors -ge 256 ]]; then print -Pn "%F{065}$c%f" else print -Pn "%F{blue}$c%f" |