From 5cb0a778af3c0386f502971f5611a3679a01bd9c Mon Sep 17 00:00:00 2001 From: Kitty Cat Date: Wed, 12 Jul 2023 07:10:37 -0400 Subject: [PATCH] zsh: more logic fixes for context color --- zsh/zshrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zsh/zshrc b/zsh/zshrc index 824efc1..88e05a2 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -72,7 +72,7 @@ function dotfiles-update() { function context-color() { hexcount=$(($(infocmp -1 | sed -n -e 's/^\t*colors#\([0-9]x\?[0-9]*\),.*/\1/p')-1)) hash=$(printf "%d\n" "0x$(hostname | md5sum | head -c 6 | tr '[:lower:]' '[:upper:]')") - excludes="0,7,15,253" + excludes="0,7,15" id=$(( $hash % $hexcount )) for excid in $(echo "$excludes" | tr "," '\n'); do if [ "$id" -eq "$excid" ]; then @@ -94,7 +94,7 @@ typeset -g POWERLEVEL9K_CONTEXT_PREFIX= typeset -g POWERLEVEL9K_CONTEXT_DEFAULT_BACKGROUND=$(context-color) typeset -g POWERLEVEL9K_CONTEXT_REMOTE_BACKGROUND=${POWERLEVEL9K_CONTEXT_DEFAULT_BACKGROUND} typeset -g POWERLEVEL9K_CONTEXT_USE_BLACK_FG=(253) -if [[ -n "${POWERLEVEL9K_CONTEXT_USE_BLACK_FG}[(r)${POWERLEVEL9K_CONTEXT_DEFAULT_BACKGROUND}]}" ]]; then +if [[ -n "${POWERLEVEL9K_CONTEXT_USE_BLACK_FG[(r)${POWERLEVEL9K_CONTEXT_DEFAULT_BACKGROUND}]}" ]]; then typeset -g POWERLEVEL9K_CONTEXT_DEFAULT_FOREGROUND=0 typeset -g POWERLEVEL9K_CONTEXT_REMOTE_FOREGROUND=0 else;