aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config/p10k-classic.zsh16
-rwxr-xr-xinternal/wizard.zsh98
2 files changed, 87 insertions, 27 deletions
diff --git a/config/p10k-classic.zsh b/config/p10k-classic.zsh
index a55302a2..fa4c5be8 100644
--- a/config/p10k-classic.zsh
+++ b/config/p10k-classic.zsh
@@ -129,13 +129,13 @@ fi
# Connect left prompt lines with these symbols. You'll probably want to use the same color
# as POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_FOREGROUND below.
- typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX='%F{240}╭─'
- typeset -g POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_PREFIX='%F{240}├─'
- typeset -g POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX='%F{240}╰─'
+ typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX='%242F╭─'
+ typeset -g POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_PREFIX='%242F├─'
+ typeset -g POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX='%242F╰─'
# Connect right prompt lines with these symbols.
- typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_SUFFIX='%F{240}─╮'
- typeset -g POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_SUFFIX='%F{240}─┤'
- typeset -g POWERLEVEL9K_MULTILINE_LAST_PROMPT_SUFFIX='%F{240}─╯'
+ typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_SUFFIX='%242F─╮'
+ typeset -g POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_SUFFIX='%242F─┤'
+ typeset -g POWERLEVEL9K_MULTILINE_LAST_PROMPT_SUFFIX='%242F─╯'
# Filler between left and right prompt on the first prompt line. You can set it to ' ', '·' or
# '─'. The last two make it easier to see the alignment between left and right prompt and to
@@ -146,7 +146,7 @@ fi
if [[ $POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_CHAR != ' ' ]]; then
# The color of the filler. You'll probably want to match the color of POWERLEVEL9K_MULTILINE
# ornaments defined above.
- typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_FOREGROUND=240
+ typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_FOREGROUND=242
# Start filler from the edge of the screen if there are no left segments on the first line.
typeset -g POWERLEVEL9K_EMPTY_LINE_LEFT_PROMPT_FIRST_SEGMENT_END_SYMBOL='%{%}'
# End filler on the edge of the screen if there are no right segments on the first line.
@@ -154,7 +154,7 @@ fi
fi
# Default background color.
- typeset -g POWERLEVEL9K_BACKGROUND=236
+ typeset -g POWERLEVEL9K_BACKGROUND=238
# Separator between same-color segments on the left.
typeset -g POWERLEVEL9K_LEFT_SUBSEGMENT_SEPARATOR='%244F\uE0B1'
diff --git a/internal/wizard.zsh b/internal/wizard.zsh
index 9ec5c15d..082df47f 100755
--- a/internal/wizard.zsh
+++ b/internal/wizard.zsh
@@ -31,7 +31,11 @@ typeset -gri force
source $__p9k_root_dir/internal/configure.zsh || return
-typeset -ri prompt_indent=4
+typeset -ri prompt_indent=2
+
+typeset -ra bg_color=(238 236 234)
+typeset -ra frame_color=(242 240 238)
+typeset -ra sep_color=(244 242 240)
typeset -ra lean_left=(
'' '%31F$extra_icons[1]%B%39F~%b%31F/%B%39Fpowerlevel10k%b%f $prefixes[1]%76F$extra_icons[2]master ⇡2%f '
@@ -44,13 +48,13 @@ typeset -ra lean_right=(
)
typeset -ra classic_left=(
- '%240F╭─' '%K{236} %31F$extra_icons[1]%B%39F~%b%K{236}%31F/%B%39Fpowerlevel10k%b%K{236} %244F\uE0B1%f $prefixes[1]%76F$extra_icons[2]master ⇡2 %k%236F\uE0B0%f'
- '%240F╰─' '%f █'
+ '%$frame_color[$color]F╭─' '%K{$bg_color[$color]} %31F$extra_icons[1]%B%39F~%b%K{$bg_color[$color]}%31F/%B%39Fpowerlevel10k%b%K{$bg_color[$color]} %$sep_color[$color]F\uE0B1%f $prefixes[1]%76F$extra_icons[2]master ⇡2 %k%$bg_color[$color]F\uE0B0%f'
+ '%$frame_color[$color]F╰─' '%f █'
)
typeset -ra classic_right=(
- '%236F\uE0B2%K{236}%f $prefixes[2]%134Fminikube ⎈ %k%f' '%240F─╮%f'
- '' '%240F─╯%f'
+ '%$bg_color[$color]F\uE0B2%K{$bg_color[$color]}%f $prefixes[2]%134Fminikube ⎈ %k%f' '%$frame_color[$color]F─╮%f'
+ '' '%$frame_color[$color]F─╯%f'
)
function prompt_length() {
@@ -97,7 +101,7 @@ function print_prompt() {
(( num_lines == 2 && i == 1 )) && local fill=$gap_char || local fill=' '
print -n -- ${(pl:$prompt_indent:: :)}
print -nP -- $l
- print -nP -- "%240F${(pl:$gap::$fill:)}%f"
+ print -nP -- "%$frame_color[$color]F${(pl:$gap::$fill:)}%f"
print -P -- $r
done
}
@@ -266,7 +270,7 @@ function ask_narrow_icons() {
q) quit; return 1;;
r) return 2;;
y) cap_narrow_icons=1; break;;
- n) cap_narrow_icons=2; break;;
+ n) cap_narrow_icons=0; break;;
esac
done
}
@@ -300,6 +304,39 @@ function ask_style() {
done
}
+function ask_color() {
+ [[ $style != classic ]] && return
+ while true; do
+ clear
+ centered "%BPrompt Color%b"
+ print -P ""
+ print -P "%B(1) Light.%b"
+ print -P ""
+ color=1 print_prompt
+ print -P ""
+ print -P "%B(2) Medium.%b"
+ print -P ""
+ color=2 print_prompt
+ print -P ""
+ print -P "%B(3) Dark.%b"
+ print -P ""
+ color=3 print_prompt
+ print -P ""
+ print -P "(r) Restart from the beginning."
+ print -P ""
+ print -P "(q) Quit and do nothing."
+ print -P ""
+
+ local key=
+ read -k key${(%):-"?%BChoice [123rq]: %b"} || return 1
+ case $key in
+ q) quit; return 1;;
+ r) return 2;;
+ 1|2|3) color=$key; break;;
+ esac
+ done
+}
+
function ask_extra_icons() {
if [[ $POWERLEVEL9K_MODE == (powerline|compatible) ]]; then
extra_icons=('' '')
@@ -603,7 +640,7 @@ function generate_config() {
local lines=("${(@f)base}")
function sub() {
- lines=("${(@)lines/# typeset -g POWERLEVEL9K_$1=*/ typeset -g POWERLEVEL9K_$1=$2}")
+ lines=("${(@)lines/#(#b)([[:space:]]#)typeset -g POWERLEVEL9K_$1=*/$match[1]typeset -g POWERLEVEL9K_$1=$2}")
}
function uncomment() {
@@ -625,6 +662,37 @@ function generate_config() {
sub BACKGROUND_JOBS_VISUAL_IDENTIFIER_EXPANSION "'⇶'"
fi
+ if [[ $style == classic ]]; then
+ sub BACKGROUND $bg_color[$color]
+ sub MULTILINE_FIRST_PROMPT_GAP_FOREGROUND $frame_color[$color]
+ sub MULTILINE_FIRST_PROMPT_PREFIX "'%$frame_color[$color]F╭─'"
+ sub MULTILINE_NEWLINE_PROMPT_PREFIX "'%$frame_color[$color]F├─'"
+ sub MULTILINE_LAST_PROMPT_PREFIX "'%$frame_color[$color]F╰─'"
+ sub MULTILINE_FIRST_PROMPT_SUFFIX "'%$frame_color[$color]F─╮'"
+ sub MULTILINE_NEWLINE_PROMPT_SUFFIX "'%$frame_color[$color]F─┤'"
+ sub MULTILINE_LAST_PROMPT_SUFFIX "'%$frame_color[$color]F─╯'"
+
+ local left_sep='\uE0B0'
+ local right_sep='\uE0B2'
+ local left_subsep='\uE0B1'
+ local right_subset='\uE0B3'
+ local left_end='\uE0B0'
+ local right_start='\uE0B2'
+
+ if (( straight )); then
+ [[ $POWERLEVEL9K_MODE == nerdfont-complete ]] && subsep='\uE0BD' || subsep='|'
+ left_end='▓▒░'
+ right_start='░▒▓'
+ fi
+
+ sub LEFT_SUBSEGMENT_SEPARATOR "'%$sep_color[$color]F$subsep'"
+ sub RIGHT_SUBSEGMENT_SEPARATOR "'%$sep_color[$color]F$subsep'"
+ sub LEFT_SEGMENT_SEPARATOR "'$subsep'"
+ sub RIGHT_SEGMENT_SEPARATOR "'$subsep'"
+ sub LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL "'$left_end'"
+ sub RIGHT_PROMPT_FIRST_SEGMENT_START_SYMBOL "'$right_start'"
+ fi
+
if [[ -n ${(j::)extra_icons} ]]; then
local branch_icon=$icons[VCS_BRANCH_ICON]
(( cap_narrow_icons )) && branch_icon=${branch_icon// }
@@ -649,16 +717,6 @@ function generate_config() {
sub CONTEXT_ROOT_TEMPLATE "'%n%f at %227F%m'"
fi
- if (( straight )); then
- [[ $POWERLEVEL9K_MODE == nerdfont-complete ]] && local subsep='\uE0BD' || local subsep='|'
- sub LEFT_SUBSEGMENT_SEPARATOR "'%244F$subsep'"
- sub RIGHT_SUBSEGMENT_SEPARATOR "'%244F$subsep'"
- sub LEFT_SEGMENT_SEPARATOR "'$subsep'"
- sub RIGHT_SEGMENT_SEPARATOR "'$subsep'"
- sub LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL "'▓▒░'"
- sub RIGHT_PROMPT_FIRST_SEGMENT_START_SYMBOL "'░▒▓'"
- fi
-
if (( num_lines == 1 )); then
local -a tmp
local line
@@ -697,6 +755,7 @@ function generate_config() {
header+=$'.\n'
header+="# Wizard options: $POWERLEVEL9K_MODE"
(( cap_narrow_icons )) && header+=", small icons" || header+=", big icons"
+ [[ $style == classic ]] && header+=", color $color"
[[ -n ${(j::)extra_icons} ]] && header+=", many icons" || header+=", few icons"
[[ -n ${(j::)prefixes} ]] && header+=", fluent" || header+=", concise"
if [[ $style == classic ]]; then
@@ -757,7 +816,7 @@ source $__p9k_root_dir/internal/icons.zsh || return
while true; do
local POWERLEVEL9K_MODE= style= config_backup= gap_char=' '
- local -i num_lines=0 write_config=0 straight=0 empty_line=0 frame=1
+ local -i num_lines=0 write_config=0 straight=0 empty_line=0 frame=1 color=1
local -i cap_diamond=0 cap_python=0 cap_narrow_icons=0 cap_lock=0
local -a extra_icons=('' '')
local -a prefixes=('' '')
@@ -785,6 +844,7 @@ while true; do
_p9k_init_icons
ask_narrow_icons || { (( $? == 2 )) && continue || return }
ask_style || { (( $? == 2 )) && continue || return }
+ ask_color || { (( $? == 2 )) && continue || return }
ask_extra_icons || { (( $? == 2 )) && continue || return }
ask_prefixes || { (( $? == 2 )) && continue || return }
ask_straight || { (( $? == 2 )) && continue || return }