Skip to content

Commit

Permalink
Adds GEOMETRY_STATUS_SYMBOL_COLOR_HASH_COLORS
Browse files Browse the repository at this point in the history
  • Loading branch information
MarioRicalde authored and Jonathan Dahan committed Aug 21, 2019
1 parent 476f960 commit 1777fb1
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion functions/geometry_status.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,17 @@ geometry_status() {

(($(echotc Co) == 256)) && colors+=({17..230})

if (( ${+GEOMETRY_STATUS_SYMBOL_COLOR_HASH_COLORS} )); then
colors=(${GEOMETRY_STATUS_SYMBOL_COLOR_HASH_COLORS})
fi

local sum=0; for c in ${(s::)^HOST}; do ((sum += $(print -f '%d' "'$c"))); done

GEOMETRY_STATUS_COLOR=${colors[$(($sum % ${#colors}))]}
local index=$(($sum % ${#colors}))

[[ "$index" -eq 0 ]] && index=1

GEOMETRY_STATUS_COLOR=${colors[${index}]}
}

local color=GEOMETRY_STATUS_COLOR symbol=GEOMETRY_STATUS_SYMBOL
Expand Down

0 comments on commit 1777fb1

Please sign in to comment.