"I wanted Terminal's background color to change based on the SSH host I access, and then change back when I log out. This hint describes how to programmatically control the color and opacity of newly created terminal windows, and is part of the solution."
This is extremely important. If your terminal with ssh looks the same for all hosts, you might forget, and reboot the wrong server! Color coding your terminal helps a lot!