Skip to content

Instantly share code, notes, and snippets.

@zemlanin
Created April 6, 2013 12:25
Show Gist options
  • Save zemlanin/5325942 to your computer and use it in GitHub Desktop.
Save zemlanin/5325942 to your computer and use it in GitHub Desktop.
zsh's prompt background color
# Генерируем цвет фона 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