Ever since TelnetLauncher's launch became stupefyingly-slow under the auspices of Rosetta, I've sought a native way to colorize my SSH terminal screens on a per-host basis. (When you've got 20+ of the damned things open at once, it helps to have a visual cue.) Many thanks to http://tempe.st/2011/04/change-your-terminal-theme-when-you-ssh-into-a-server and http://www.rngtng.com/2011/01/14/mac-os-x-terminal-visual-indication-for-your-ssh-connection for the basic functions. I've extended the basic idea with a little "case" logic to select a different profile (including colors, font, sizing, terminal characteristics) based upon the arguments to 'ssh'.
Note the use of the pipe character ("|") as a logical OR in one case to trigger the profile change whether the host is addressed by name or by IP address. Clearly, this requires you to maintain the correct name-to-IP mapping yourself, if you choose to go this route. Additionally note that, while the use of wildcards to work around command-line arguments and "username@" syntax is convenient, it may instigate ambiguity with similarly-named hosts. e.g., "bertandernie.foo.com" gets ernie.foo.com's profile, whether you want it to or not. Caveat lector.
Add the following to ~/.bash_profile, then run '. ~/.bash_profile':
# for special, per-host Terminal appearance... function tabc { NAME=$1; if [ -z "$NAME" ]; then NAME="Homebrew"; fi osascript -e "tell application \"Terminal\" to set current settings of front window to settings set \"$NAME\"" } function ssh { case "$@" in # use "Red Sands" when connecting to bert.foo.bar... *bert.foo.bar*) tabc "Red Sands"; /usr/bin/ssh "$@"; ;; # use "Ocean" when connecting to ernie.foo.bar... *ernie.foo.bar*|*192.168.16.75*) tabc "Ocean"; /usr/bin/ssh "$@"; ;; # a sensible default in case we don't find # a hostname that we know... *) tabc "Homebrew"; /usr/bin/ssh "$@"; ;; esac # return to the default on exit... tabc "Homebrew"; }