imprv: colors

This commit is contained in:
2026-03-12 08:17:19 +01:00
parent 7653f052b7
commit 3210a8bbcf
3 changed files with 28 additions and 22 deletions

View File

@@ -73,9 +73,8 @@ FZF_DEFAULT_THREAD_LINE="{1} {3} ({4})"
if [ "${1:-}" = "--show-thread" ]; then if [ "${1:-}" = "--show-thread" ]; then
shift shift
thread="$1" thread="$1"
res=$(__notmuch_thread "$thread" | fzf \ res=$(__notmuch_thread "$thread" | $FZF \
--raw \ --raw \
--ansi \
--reverse \ --reverse \
--multi \ --multi \
--delimiter="$(printf '\t')" \ --delimiter="$(printf '\t')" \
@@ -106,9 +105,8 @@ CMD_EDIT_QUERY="edit-query"
while true; do while true; do
nmquery="${nmquery:-tag:inbox}" nmquery="${nmquery:-tag:inbox}"
[ "$(tail -1 "$NMFHIST")" = "$nmquery" ] || echo "$nmquery" >> "$NMFHIST" [ "$(tail -1 "$NMFHIST")" = "$nmquery" ] || echo "$nmquery" >> "$NMFHIST"
cmd=$(__notmuch_search "$nmquery" | fzf \ cmd=$(__notmuch_search "$nmquery" | $FZF \
--header="Query: $nmquery" \ --header="Query: $nmquery" \
--ansi \
--tiebreak=index \ --tiebreak=index \
--reverse \ --reverse \
--multi \ --multi \
@@ -131,32 +129,33 @@ while true; do
[ -n "$cmd" ] || exit 0 [ -n "$cmd" ] || exit 0
case "$cmd" in case "$cmd" in
$CMD_SEARCH_TAG*) $CMD_SEARCH_TAG*)
tag=$(__notmuch_list_tags | fzf \ tag=$(__notmuch_list_tags | $FZF \
--ansi \ --color="border:$ANSICOLORTAGS" \
--cycle \ --color="label:$ANSICOLORTAGS" \
--tac \
--bind='ctrl-d:half-page-down,ctrl-u:half-page-up' \ --bind='ctrl-d:half-page-down,ctrl-u:half-page-up' \
--margin='20%' \ --margin='20%' \
--bind='enter:accept-or-print-query' \ --bind='enter:accept-or-print-query' \
--border=double \ --border=double \
--border-label='Select tag' || true) --border-label=" Select tag " || true)
[ -n "$tag" ] || continue [ -n "$tag" ] || continue
[ "$cmd" = "$CMD_SEARCH_TAG$APPEND" ] && nmquery="$nmquery and tag:$tag" || nmquery="tag:$tag" [ "$cmd" = "$CMD_SEARCH_TAG$APPEND" ] && nmquery="$nmquery and tag:$tag" || nmquery="tag:$tag"
;; ;;
$CMD_SEARCH_ADDRESS*) $CMD_SEARCH_ADDRESS*)
case "$cmd" in case "$cmd" in
*$ADDRESS_FROM*) *$ADDRESS_FROM*)
label_text='Select sender' label_text=" Select sender "
field='from' field='from'
;; ;;
*) *)
label_text='Select recipient' label_text=" Select recipient "
field='to' field='to'
;; ;;
esac esac
address=$(__notmuch_list_address | fzf \ address=$(__notmuch_list_address | $FZF \
--ansi \ --color="border:$ANSICOLORFROM" \
--color="label:$ANSICOLORFROM" \
--tiebreak=index \ --tiebreak=index \
--cycle \
--bind='ctrl-d:half-page-down,ctrl-u:half-page-up' \ --bind='ctrl-d:half-page-down,ctrl-u:half-page-up' \
--margin='20%' \ --margin='20%' \
--bind='enter:accept-or-print-query' \ --bind='enter:accept-or-print-query' \
@@ -173,8 +172,9 @@ while true; do
esac esac
;; ;;
$CMD_EDIT_QUERY*) $CMD_EDIT_QUERY*)
nmquery=$(fzf \ nmquery=$($FZF \
--ansi \ --color="border:$ANSICOLORSUBJ" \
--color="label:$ANSICOLORSUBJ" \
--tac \ --tac \
--bind='ctrl-d:half-page-down,ctrl-u:half-page-up' \ --bind='ctrl-d:half-page-down,ctrl-u:half-page-up' \
--margin='20%' \ --margin='20%' \
@@ -184,7 +184,7 @@ while true; do
--prompt="Query: " \ --prompt="Query: " \
--bind='focus:replace-query' \ --bind='focus:replace-query' \
--border=double \ --border=double \
--border-label='Query history' < "$NMFHIST" | head -1 || true) --border-label=' Query history ' < "$NMFHIST" | head -1 || true)
;; ;;
*) *)
;; ;;

View File

@@ -1,12 +1,18 @@
# Default theme # Default theme
if [ ! "${THEME_LOADED:-}" ]; then if [ ! "${THEME_LOADED:-}" ]; then
COLDATE="$(printf '\033[38;5;195m')" ANSICOLORDATE="${ANSICOLORDATE:-195}"
COLCNTS="$(printf '\033[38;5;244m')" ANSICOLORCNTS="${ANSICOLORCNTS:-244}"
COLFROM="$(printf '\033[38;5;208m')" ANSICOLORFROM="${ANSICOLORFROM:-208}"
COLSUBJ="$(printf '\033[38;5;179m\033[3m')" ANSICOLORSUBJ="${ANSICOLORSUBJ:-179}"
COLTAGS="$(printf '\033[38;5;106m\033[2m')" ANSICOLORTAGS="${ANSICOLORTAGS:-106}"
COLDATE="$(printf '\033[38;5;%sm' "$ANSICOLORDATE")"
COLCNTS="$(printf '\033[38;5;%sm' "$ANSICOLORCNTS")"
COLFROM="$(printf '\033[38;5;%sm' "$ANSICOLORFROM")"
COLSUBJ="$(printf '\033[38;5;%sm\033[3m' "$ANSICOLORSUBJ")"
COLTAGS="$(printf '\033[38;5;%sm\033[2m' "$ANSICOLORTAGS")"
COLRESET="$(printf '\033[0m')" COLRESET="$(printf '\033[0m')"
export ANSICOLORDATE ANSICOLORCNTS ANSICOLORFROM ANSICOLORSUBJ ANSICOLORTAGS
export COLDATE COLCNTS COLFROM COLSUBJ COLTAGS COLRESET export COLDATE COLCNTS COLFROM COLSUBJ COLTAGS COLRESET
export THEME_LOADED=1 export THEME_LOADED=1

View File

@@ -1,6 +1,6 @@
if [ ! "${TOOLS_LOADED:-}" ]; then if [ ! "${TOOLS_LOADED:-}" ]; then
if command -v "fzf" >/dev/null; then if command -v "fzf" >/dev/null; then
FZF="fzf --black --ansi --cycle --tiebreak=chunk,index" FZF="fzf --black --ansi --cycle --info=inline-right"
else else
err "Did not find the command-line fuzzy finder fzf." err "Did not find the command-line fuzzy finder fzf."
exit 1 exit 1