Created
April 6, 2013 12:25
-
-
Save zemlanin/5325942 to your computer and use it in GitHub Desktop.
zsh's prompt background color
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Генерируем цвет фона prompt'а, основываясь на md5-сумме hostname (только первые 2 шестнадцатеричные цифры) | |
export TERM=xterm-256color | |
__colorcode=$( | |
( | |
echo "ibase=16"; hostname | md5sum | cut -c1-2 | tr "[:lower:]" "[:upper:]" | |
) | bc | awk '{printf "[48;5;%dm", $1}' # Перед "[" стоит ESC-символ, который не отображается в браузере | |
) | |
RPROMPT='%{$__colorcode%}%n%{$reset_color%}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment