diff --git a/commands/choose b/commands/choose index ce7ddf8d6..32137711c 100755 --- a/commands/choose +++ b/commands/choose @@ -316,6 +316,7 @@ function choose_() ( color_disable_invert \ color_foreground_black \ color_foreground_green \ + color_foreground_intense_white \ color_foreground_intense_green \ color_foreground_intense_magenta \ color_foreground_intense_yellow \ @@ -324,13 +325,22 @@ function choose_() ( icon_active \ icon_default \ icon_standard \ + style_count_more_begin \ + style_count_more_end \ + style_count_default_begin \ + style_count_default_end \ + style_count_selected_begin \ + style_count_selected_end \ style_help_begin \ style_help_end \ style_key_begin \ style_key_begin \ style_key_end \ style_key_end \ - style_key_indent=' ' + style_key_indent=' ' \ + style_active_line \ + style_selected_line \ + style_default_line if test "$use_colors" = 'no'; then color_reset='' color_bold='' @@ -345,6 +355,7 @@ function choose_() ( color_disable_invert='' color_foreground_black='' color_foreground_green='' + color_foreground_intense_white='' color_foreground_intense_black='' color_foreground_intense_green='' color_foreground_intense_magenta='' @@ -355,6 +366,9 @@ function choose_() ( style_help_end='' style_key_begin='[' style_key_end=']' + style_active_line='' + style_selected_line='' + style_default_line='' else color_reset=$'\e[0m' color_bold=$'\e[1m' @@ -369,6 +383,7 @@ function choose_() ( color_disable_invert=$'\e[27m' color_foreground_black=$'\e[30m' color_foreground_green=$'\e[32m' + color_foreground_intense_white=$'\e[97m' color_foreground_intense_black=$'\e[90m' color_foreground_intense_green=$'\e[92m' color_foreground_intense_magenta=$'\e[95m' @@ -377,13 +392,32 @@ function choose_() ( color_foreground_yellow=$'\e[33m' color_background_white=$'\e[47m' color_background_intense_white=$'\e[107m' - style_help_begin="$color_dim" - style_help_end="$color_reset" + style_active_line="$color_invert" + style_count_default_begin="$color_foreground_yellow" + style_count_selected_begin="$color_foreground_green" if test "$(get-terminal-theme || :)" = 'dark'; then + style_count_more_begin="$color_foreground_white" + style_count_more_end="$color_disable_foreground" + style_help_begin="$color_dim" # dim is better than white, nice separation style_key_begin="${color_foreground_black}${color_background_white} " + style_default_line="$color_foreground_intense_yellow" + style_selected_line="$color_foreground_intense_green" else + # style_count_more_begin="$color_foreground_black" # same as the items, too confusing + # style_count_more_end="$color_disable_foreground" + style_count_more_begin="$color_foreground_intense_black" # not enough distinction from the items, however, dim is too dim + style_count_more_end="$color_disable_foreground" + # style_count_more_begin="$color_dim" # not readable enough + # style_count_more_end="$color_disable_intensity" + style_help_begin="$color_foreground_intense_black" style_key_begin="${color_background_intense_white} " # foreground default black, background intense white + # for count and selected, intense is too bright, dim is too light + style_default_line="$color_foreground_yellow" + style_selected_line="$color_foreground_green" fi + style_count_default_end="$color_disable_foreground" + style_count_selected_end="$color_disable_foreground" + style_help_end="$color_reset" style_key_end=" $color_reset" fi if test "$option_multi" = 'yes'; then @@ -1163,17 +1197,17 @@ function choose_() ( line_prefix='' line_style='' if test "$menu_index" -eq "$menu_cursor"; then - line_style+="$color_invert" + line_style+="$style_active_line" line_prefix+='⏵ ' else line_prefix+=' ' fi if test "${selected[item_index]-}" = 'yes' -a "$menu_mode" != 'cancel'; then - line_style+="$color_foreground_intense_green" + line_style+="$style_selected_line" line_prefix+="$icon_selected " page_visible_selected_count="$((page_visible_selected_count + 1))" elif test "${defaults[item_index]-}" = 'yes'; then - line_style+="$color_foreground_intense_yellow" + line_style+="$style_default_line" line_prefix+="$icon_default " page_visible_unselected_defaults_count="$((page_visible_unselected_defaults_count + 1))" elif test "$menu_index" -eq "$menu_cursor"; then @@ -1323,7 +1357,7 @@ function choose_() ( if test "$menu_top_index" -eq 0; then if test "$menu_mode" = 'choose'; then # choose: fetch all below - page_header+="${page_hint_indent}${below_open_symbol} ${color_foreground_white}choose any $menu_total below${color_disable_foreground}" + page_header+="${page_hint_indent}${below_open_symbol} ${style_count_more_begin}choose any $menu_total below${style_count_more_end}" page_header_selected_count="$selected_count" for index in "${default_indexes[@]}"; do if test "${selected[index]-}" = 'yes'; then @@ -1332,15 +1366,15 @@ function choose_() ( page_header_unselected_defaults_count="$((page_header_unselected_defaults_count + 1))" done elif test "$menu_mode" = 'cancel'; then - page_header+="${page_hint_indent}${below_open_symbol} ${color_foreground_yellow}cancel to all $menu_total defaults below${color_disable_foreground}" + page_header+="${page_hint_indent}${below_open_symbol} ${style_count_default_begin}cancel to all $menu_total defaults below${style_count_default_end}" else - page_header+="${page_hint_indent}${below_open_symbol} ${color_foreground_green}confirm all $menu_total selected below${color_disable_foreground}" + page_header+="${page_hint_indent}${below_open_symbol} ${style_count_selected_begin}confirm all $menu_total selected below${style_count_selected_end}" fi header_close_symbol="$below_close_symbol" else if test "$menu_mode" = 'choose'; then # choose: fetch more above - page_header+="${page_hint_indent}${continue_open_symbol} ${color_foreground_white}$menu_top_index more above${color_disable_foreground}" + page_header+="${page_hint_indent}${continue_open_symbol} ${style_count_more_begin}$menu_top_index more above${style_count_more_end}" for index in "${selected_indexes[@]}"; do if test "$index" -ge "$menu_top_index"; then break @@ -1357,7 +1391,7 @@ function choose_() ( page_header_unselected_defaults_count="$((page_header_unselected_defaults_count + 1))" done elif test "$menu_mode" = 'cancel'; then - page_header+="${page_hint_indent}${continue_open_symbol} ${color_foreground_yellow}$menu_top_index more defaults above${color_disable_foreground}" + page_header+="${page_hint_indent}${continue_open_symbol} ${style_count_default_begin}$menu_top_index more defaults above${style_count_default_end}" else page_header+="${page_hint_indent}${continue_open_symbol} ${color_foreground_green}$menu_top_index more selected above${color_disable_foreground}" fi @@ -1368,7 +1402,7 @@ function choose_() ( if test "$menu_bottom_index" -eq "$menu_last_index"; then if test "$menu_mode" = 'choose'; then # choose: fetch all above - page_footer+="${page_hint_indent}${above_open_symbol} ${color_foreground_white}choose any $menu_total above${color_disable_foreground}" + page_footer+="${page_hint_indent}${above_open_symbol} ${style_count_more_begin}choose any $menu_total above${style_count_more_end}" page_footer_selected_count="$selected_count" for index in "${default_indexes[@]}"; do if test "${selected[index]-}" = 'yes'; then @@ -1377,16 +1411,16 @@ function choose_() ( page_footer_unselected_defaults_count="$((page_footer_unselected_defaults_count + 1))" done elif test "$menu_mode" = 'cancel'; then - page_footer+="${page_hint_indent}${above_open_symbol} ${color_foreground_yellow}cancel to all $menu_total defaults above${color_disable_foreground}" + page_footer+="${page_hint_indent}${above_open_symbol} ${style_count_default_begin}cancel to all $menu_total defaults above${style_count_default_end}" else - page_footer+="${page_hint_indent}${above_open_symbol} ${color_foreground_green}confirm all $menu_total selected above${color_disable_foreground}" + page_footer+="${page_hint_indent}${above_open_symbol} ${style_count_selected_begin}confirm all $menu_total selected above${style_count_selected_end}" fi footer_close_symbol="$above_close_symbol" else index="$((menu_last_index - menu_bottom_index))" if test "$menu_mode" = 'choose'; then # choose: fetch more below - page_footer+="${page_hint_indent}${continue_open_symbol} ${color_foreground_white}$index more below${color_disable_foreground}" + page_footer+="${page_hint_indent}${continue_open_symbol} ${style_count_more_begin}$index more below${style_count_more_end}" for index in "${selected_indexes[@]}"; do if test "$index" -le "$menu_bottom_index"; then continue @@ -1400,9 +1434,9 @@ function choose_() ( page_footer_unselected_defaults_count="$((page_footer_unselected_defaults_count + 1))" done elif test "$menu_mode" = 'cancel'; then - page_footer+="${page_hint_indent}${continue_open_symbol} ${color_foreground_yellow}cancel to $index more defaults below${color_disable_foreground}" + page_footer+="${page_hint_indent}${continue_open_symbol} ${style_count_default_begin}cancel to $index more defaults below${style_count_default_end}" else - page_footer+="${page_hint_indent}${continue_open_symbol} ${color_foreground_green}confirm $index more selected below${color_disable_foreground}" + page_footer+="${page_hint_indent}${continue_open_symbol} ${style_count_selected_begin}confirm $index more selected below${style_count_selected_end}" fi footer_close_symbol="$continue_close_symbol" fi @@ -1410,30 +1444,30 @@ function choose_() ( # add selected and unslected defaults counts if test "$menu_mode" = 'choose'; then if test "$page_header_selected_count" -ne 0; then - page_header+=" ${sep_symbol} ${color_foreground_green}${page_header_selected_count} selected${color_disable_foreground}" + page_header+=" ${sep_symbol} ${style_count_selected_begin}${page_header_selected_count} selected${style_count_selected_end}" fi if test "$page_header_unselected_defaults_count" -ne 0; then - page_header+=" ${sep_symbol} ${color_foreground_yellow}${page_header_unselected_defaults_count} unselected defaults${color_disable_foreground}" + page_header+=" ${sep_symbol} ${style_count_default_begin}${page_header_unselected_defaults_count} unselected defaults${style_count_default_end}" fi - page_visible+="${page_hint_indent}${continue_open_symbol} ${color_foreground_white}$page_count visible${color_disable_foreground}" + page_visible+="${page_hint_indent}${continue_open_symbol} ${style_count_more_begin}$page_count visible${style_count_more_end}" if test -n "$page_visible"; then if test "$page_visible_selected_count" -ne 0; then - page_visible+=" ${sep_symbol} ${color_foreground_green}${page_visible_selected_count} selected${color_disable_foreground}" + page_visible+=" ${sep_symbol} ${style_count_selected_begin}${page_visible_selected_count} selected${style_count_selected_end}" fi if test "$page_visible_unselected_defaults_count" -ne 0; then - page_visible+=" ${sep_symbol} ${color_foreground_yellow}${page_visible_unselected_defaults_count} unselected defaults${color_disable_foreground}" + page_visible+=" ${sep_symbol} ${style_count_default_begin}${page_visible_unselected_defaults_count} unselected defaults${style_count_default_end}" fi fi if test "$page_footer_selected_count" -ne 0; then - page_footer+=" ${sep_symbol} ${color_foreground_green}${page_footer_selected_count} selected${color_disable_foreground}" + page_footer+=" ${sep_symbol} ${style_count_selected_begin}${page_footer_selected_count} selected${style_count_selected_end}" fi if test "$page_footer_unselected_defaults_count" -ne 0; then - page_footer+=" ${sep_symbol} ${color_foreground_yellow}${page_footer_unselected_defaults_count} unselected defaults${color_disable_foreground}" + page_footer+=" ${sep_symbol} ${style_count_default_begin}${page_footer_unselected_defaults_count} unselected defaults${style_count_default_end}" fi elif test "$menu_mode" = 'cancel'; then - page_visible+="${page_hint_indent}${continue_open_symbol} ${color_foreground_yellow}$page_count visible${color_disable_foreground}" + page_visible+="${page_hint_indent}${continue_open_symbol} ${style_count_default_begin}$page_count visible${style_count_default_end}" else - page_visible+="${page_hint_indent}${continue_open_symbol} ${color_foreground_green}$page_count visible${color_disable_foreground}" + page_visible+="${page_hint_indent}${continue_open_symbol} ${style_count_selected_begin}$page_count visible${style_count_selected_end}" fi page_header+=" ${header_close_symbol}"$'\n'