display lean with 8 colors right away if the terminal does not support 256 colors

This commit is contained in:
romkatv 2020-01-21 11:48:39 +01:00
parent fc7178ad92
commit 0f9cee9dc2

View file

@ -571,13 +571,14 @@ function ask_style() {
else else
local nl=$'\n' local nl=$'\n'
fi fi
(( terminfo[colors] >= 256 )) && local lean=lean || local lean=lean_8colors
while true; do while true; do
clear clear
flowing -c "%BPrompt Style%b" flowing -c "%BPrompt Style%b"
print -n $nl print -n $nl
print -P "%B(1) Lean.%b" print -P "%B(1) Lean.%b"
print -n $nl print -n $nl
style=lean left_frame=0 right_frame=0 print_prompt style=$lean left_frame=0 right_frame=0 print_prompt
print -P "" print -P ""
print -P "%B(2) Classic.%b" print -P "%B(2) Classic.%b"
print -n $nl print -n $nl
@ -600,12 +601,16 @@ function ask_style() {
case $key in case $key in
q) quit;; q) quit;;
r) return 1;; r) return 1;;
1) style=lean; left_frame=0; right_frame=0; options+=lean; break;; 1) style=$lean; left_frame=0; right_frame=0; options+=$lean; break;;
2) style=classic; options+=classic; break;; 2) style=classic; options+=classic; break;;
3) style=rainbow; options+=rainbow; break;; 3) style=rainbow; options+=rainbow; break;;
4) style=pure; empty_line=1; options+=pure; break;; 4) style=pure; empty_line=1; options+=pure; break;;
esac esac
done done
if [[ $style == lean_8colors ]]; then
frame_color=(0 7 2 4)
color_name=(Black White Green Blue)
fi
} }
function ask_color_scheme() { function ask_color_scheme() {
@ -641,6 +646,7 @@ function ask_color_scheme() {
;; ;;
esac esac
done done
options=(${options:#lean} $style)
elif [[ $style == pure && $has_truecolor == 1 ]]; then elif [[ $style == pure && $has_truecolor == 1 ]]; then
while true; do while true; do
clear clear
@ -1774,6 +1780,7 @@ else
_p9k_can_configure -q || return _p9k_can_configure -q || return
fi fi
zmodload zsh/terminfo || return
autoload -Uz is-at-least || return autoload -Uz is-at-least || return
source $__p9k_root_dir/internal/icons.zsh || return source $__p9k_root_dir/internal/icons.zsh || return