Created
June 26, 2018 23:51
-
-
Save kei-p/814920d62d0c38182f01bdea453979af to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
# | |
# (1) copy to: ~/bin/ssh-host-colorize | |
# (2) set: alias ssh=~/bin/ssh-host-colorize | |
# | |
set_term_bgcolor(){ | |
local R=$1 | |
local G=$2 | |
local B=$3 | |
local OPACITY=$4 | |
/usr/bin/osascript <<EOF | |
tell application "iTerm" | |
tell the current window | |
tell the current session | |
set background color to {$(($R*65535/255)), $(($G*65535/255)), $(($B*65535/255))} | |
set transparency to "$OPACITY" | |
end tell | |
end tell | |
end tell | |
EOF | |
} | |
red='40 0 0 0.025' | |
green='0 40 0 0.025' | |
if [[ "$@" =~ production ]]; then | |
set_term_bgcolor $red | |
elif [[ "$@" =~ maintenance ]]; then | |
set_term_bgcolor $red | |
elif [[ "$@" =~ staging ]]; then | |
set_term_bgcolor $green | |
fi | |
ssh $@ | |
# set_term_bgcolor 39 40 33 0.025 | |
set_term_bgcolor 33 34 27 0.025 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment