From a0290b7f40c7c839136057a5457c16726a3e94ff Mon Sep 17 00:00:00 2001 From: Kitty Cat Date: Wed, 12 Jul 2023 06:52:42 -0400 Subject: [PATCH] zsh: change context color exclusion handling --- zsh/zshrc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/zsh/zshrc b/zsh/zshrc index 7b58ea2..fef55b1 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -72,10 +72,11 @@ 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" + excludes="0,7,15,253" id=$(( $hash % $hexcount )) for excid in $(echo "$excludes" | tr "," '\n'); do - if [ "$id" -ge "$excid" ]; then + id=$(( $hash * $hash % $hexcount )) + if [ "$id" -eq "$excid" ]; then id=$((id + 1)) fi done