Changing Terminal colors when ssh-ing into remote machine and back
I'm using the following.

Have a shell command, called myssh, with content:

PROFILE="$1";shift;
DEF="Basic" #the default profile name
echo "tell app \"Terminal\" to set current settings of first window to settings set \"${PROFILE}\""|osascript
ssh $@
echo "tell app \"Terminal\" to set current settings of first window to settings set \"${DEF}\""|osascript


and use bash aliases for the connect, like:

alias ssweb='myssh Homebrew user@web.example.com'
alias ssmail='myssh Ocean me@mail.example.com'


When I want to ssh into the web server, I simply write ssweb in the Terminal and I got the "Homebrew" profile. When the ssh session ends, the AppleScript sets back to the "Basic".

The aliases should go into your $HOME/.profile or similar bash-startup file.

The "Homebrew", "Ocean" etc. are the setting profiles from the Terminal.app preferences. You can also set up different fonts, encodings, etc.

Of course, you can use it directly (without aliases) like:

myssh Pro user@another.machine.example.com
       ^        ^
       |        ssh command arguments
       terminal profile name