Is there an escape sequence that will change the background color in Terminal? All of the approaches that I have seen for changing the background color in Terminal use applescript; is there an escape sequence? All of the hints that I've seen, like this one, use AppleScript. I want to put it in my .base_profile and in the 'ssh' command so that when I hop from system to system the color changes properly. (I sometimes have to hop multiple systems in due to connectivity issues)
I have this in my bash_profile:

# Change the terminal theme when SSH to remote
function tabc() {
    NAME=$1; if [ -z "$NAME" ]; then NAME="Default"; fi
    osascript -e "tell application \"Terminal\" to set current settings of front window to settings set \"$NAME\""
}

# Change the terminal color when remote
function ssh {
  tabc "Hiltmon-Remote"
  /usr/bin/ssh "$@"
  tabc "Hiltmon"
}


It uses Applescript (which you don't want) to change the terminal profile.  Replace the Hiltmon and Hiltmon-Remote with your own color scheme names. When you use the ssh command, the macro changes the shell theme, then runs ssh. When you exit the remote session, it changes it back. Very cool!

I tried using the shell color escape sequences like \[\e[36m\] and \[\e[0m\] but the remote session can and does reset them. This works great for me.