mirror of
https://github.com/KiTTYsh/dotfiles.git
synced 2025-12-09 20:59:16 -05:00
zsh: change context color exclusion handling
This commit is contained in:
@@ -72,10 +72,11 @@ function dotfiles-update() {
|
|||||||
function context-color() {
|
function context-color() {
|
||||||
hexcount=$(($(infocmp -1 | sed -n -e 's/^\t*colors#\([0-9]x\?[0-9]*\),.*/\1/p')-1))
|
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:]')")
|
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 ))
|
id=$(( $hash % $hexcount ))
|
||||||
for excid in $(echo "$excludes" | tr "," '\n'); do
|
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))
|
id=$((id + 1))
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user