mirror of
https://github.com/KiTTYsh/dotfiles.git
synced 2025-12-09 20:59:16 -05:00
zsh: more logic fixes for context color
This commit is contained in:
@@ -72,7 +72,7 @@ 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,253"
|
excludes="0,7,15"
|
||||||
id=$(( $hash % $hexcount ))
|
id=$(( $hash % $hexcount ))
|
||||||
for excid in $(echo "$excludes" | tr "," '\n'); do
|
for excid in $(echo "$excludes" | tr "," '\n'); do
|
||||||
if [ "$id" -eq "$excid" ]; then
|
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_DEFAULT_BACKGROUND=$(context-color)
|
||||||
typeset -g POWERLEVEL9K_CONTEXT_REMOTE_BACKGROUND=${POWERLEVEL9K_CONTEXT_DEFAULT_BACKGROUND}
|
typeset -g POWERLEVEL9K_CONTEXT_REMOTE_BACKGROUND=${POWERLEVEL9K_CONTEXT_DEFAULT_BACKGROUND}
|
||||||
typeset -g POWERLEVEL9K_CONTEXT_USE_BLACK_FG=(253)
|
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_DEFAULT_FOREGROUND=0
|
||||||
typeset -g POWERLEVEL9K_CONTEXT_REMOTE_FOREGROUND=0
|
typeset -g POWERLEVEL9K_CONTEXT_REMOTE_FOREGROUND=0
|
||||||
else;
|
else;
|
||||||
|
|||||||
Reference in New Issue
Block a user