OK, if you insist on calling ssh from the command line, this is what the trick should do: write a shell script and save it somewhere as colorssh.sh . When it starts, it looks through its arguments for the corresponding host and sets the colors of the active terminal window accordingly. Then it calls a valid ssh passing through these arguments. When ssh returns execution in a script, it returns the colors to normal.
Since you probably want to type ssh instead of colorssh.sh , you can set an alias in your .profile .
As for the script itself? Here is the code:
#!/bin/bash function setTerminalColors { osascript \ -e "tell application \"Terminal\"" \ -e "tell selected tab of front window" \ -e "set normal text color to $1" \ -e "set background color to $2" \ -e "end tell" \ -e "end tell" } for ARG in $* do case "$ARG" in host.example.com) username@host.example.com ) setTerminalColors "{0,65535,65535}" "{65535,0,0}" ;; username@otherhost.example.com ) setTerminalColors "{65535,65535,0}" "{0,65535,0}" ;; esac done ssh $*
You will need to edit the script to add new combinations of hosts and colors.
Note that colors must be specified as an RGB triplet of integers in the range 0-65535. I know, strange, right?
Technically, part of AppleScript modifies deprecated properties. You should change the colors of the window using the "set set" property, but I suspect that this will change all the windows using this set of settings, not just the current one.
In addition, this script assumes that your โnormalโ setting is black and white. If this is not the case, you can modify the script to save the current values โโbefore running or use the colors from the default settings.
benzado
source share