Skip to content

Instantly share code, notes, and snippets.

@c3zi
Last active March 5, 2019 14:56
Show Gist options
  • Select an option

  • Save c3zi/1a4cfe8ac8f0761d98a7cc5d2e1ce5ce to your computer and use it in GitHub Desktop.

Select an option

Save c3zi/1a4cfe8ac8f0761d98a7cc5d2e1ce5ce to your computer and use it in GitHub Desktop.
Set a background color in Terminal (tested on Gnome terminal) for different SSH environments
Host dev
HostName 127.0.0.1
User c3zi
Host demo
HostName 127.0.0.2
User c3zi
Host test
HostName 127.0.0.3
User c3zi
.....
.....
.....
color-ssh() {
trap "~/Progz/colortheme.sh" INT EXIT
printf "\033c"
if [[ "$*" =~ "demo" ]]; then
printf "\033[01;33mDANGER! DANGER! DANGER!\n\n"
printf "\033[1;31m"
printf "██████╗ ███████╗███╗ ███╗ ██████╗ ███████╗███████╗██████╗ ██╗ ██╗███████╗██████╗\n"
printf "██╔══██╗██╔════╝████╗ ████║██╔═══██╗ ██╔════╝██╔════╝██╔══██╗██║ ██║██╔════╝██╔══██╗\n"
printf "██║ ██║█████╗ ██╔████╔██║██║ ██║ ███████╗█████╗ ██████╔╝██║ ██║█████╗ ██████╔╝\n"
printf "██║ ██║██╔══╝ ██║╚██╔╝██║██║ ██║ ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██╔══╝ ██╔══██╗\n"
printf "██████╔╝███████╗██║ ╚═╝ ██║╚██████╔╝ ███████║███████╗██║ ██║ ╚████╔╝ ███████╗██║ ██║\n"
printf "╚═════╝ ╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚══════╝╚═╝ ╚═╝\n\n"
printf "\033[01;33mDANGER! DANGER! DANGER!\n\n"
printf "\033[0m";
~/Progz/colortheme.sh demo
elif [[ "$*" =~ "test" ]]; then
printf "\033[01;33mDANGER! DANGER! DANGER!\n\n"
printf "████████╗███████╗███████╗████████╗ ███████╗███████╗██████╗ ██╗ ██╗███████╗██████╗\n"
printf "╚══██╔══╝██╔════╝██╔════╝╚══██╔══╝ ██╔════╝██╔════╝██╔══██╗██║ ██║██╔════╝██╔══██╗\n"
printf " ██║ █████╗ ███████╗ ██║ ███████╗█████╗ ██████╔╝██║ ██║█████╗ ██████╔╝\n"
printf " ██║ ██╔══╝ ╚════██║ ██║ ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██╔══╝ ██╔══██╗\n"
printf " ██║ ███████╗███████║ ██║ ███████║███████╗██║ ██║ ╚████╔╝ ███████╗██║ ██║\n"
printf " ╚═╝ ╚══════╝╚══════╝ ╚═╝ ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚══════╝╚═╝ ╚═╝\n\n"
printf "\033[01;33mDANGER! DANGER! DANGER!\n\n"
printf "\033[0m";
~/Progz/colortheme.sh test
elif [[ "$*" =~ "dev" ]]; then
printf "\n\n"
printf " _____ ______ __ __ _____ ______ _____ __ __ ______ _____ \n"
printf "| __ \ | ____| \ \ / / / ____| | ____| | __ \ \ \ / / | ____| | __ \ \n"
printf "| | | | | |__ \ \ / / | (___ | |__ | |__) | \ \ / / | |__ | |__) | \n"
printf "| | | | | __| \ \/ / \___ \ | __| | _ / \ \/ / | __| | _ / \n"
printf "| |__| | | |____ \ / ____) | | |____ | | \ \ \ / | |____ | | \ \ \n"
printf "|_____/ |______| \/ |_____/ |______| |_| \_\ \/ |______| |_| \_\ \n\n"
~/Progz/colortheme.sh dev
else
~/Progz/colortheme.sh other
fi
ssh $*
}
....
alias ssh=color-ssh
#!/bin/bash
if [ "$1" == "demo" ]; then
printf '\033]11;#331C1F\007'
elif [ "$1" == "test" ]; then
printf '\033]11;#193436\007'
elif [ "$1" == "dev" ]; then
printf '\033]11;#192436\007'
elif [ "$1" == "other" ]; then
printf '\033]11;#253320\007'
else
printf '\033]11;#282c34\007'
fi
@c3zi
Copy link
Author

c3zi commented Jan 28, 2019

And then just call ssh demo or ssh test or any different environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment