Last active
December 31, 2015 17:39
-
-
Save hatarist/8022085 to your computer and use it in GitHub Desktop.
(zsh) Colorize iTerm2 prompt when connecting to SSH servers
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
alias sww="iterm_bg_color 30 0 0; ssh web-production; iterm_bg_color 0 0 0" | |
alias swt="iterm_bg_color 0 20 20; ssh web-test; iterm_bg_color 0 0 0" | |
function iterm_bg_color() { | |
local tty=$(tty) | |
osascript -e " | |
tell application \"iTerm\" | |
repeat with theTerminal in terminals | |
tell theTerminal | |
try | |
tell session id \"$tty\" | |
set background color to {(($1 * 257)), (($2 * 257)), (($3 * 257))} as RGB color | |
end tell | |
on error errmesg number errn | |
end try | |
end tell | |
end repeat | |
end tell" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment