Last active
March 5, 2019 14:56
-
-
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
This file contains hidden or 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
| 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 |
This file contains hidden or 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
| ..... | |
| ..... | |
| ..... | |
| 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 |
This file contains hidden or 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 | |
| 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 | |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
And then just call
ssh demoorssh testor any different environment.