INewer versions of tmux allow for the use of 24 bit colors, so instead of mapping to a color from 0-255, we can pass in a complete hex string that is generated from the hostname. Unfortunately, while there are spots in tmux.conf where it can call an external command, this is limited to text only fields such as status-left and status-right and it does not generally work for visual properties. Maybe the hexdump format stringHowever, we can make use of the cut part obsolete, but I didn't figure out how.
.tmux.confrun command in tmux.conf to work around this:
run "tmux set -g status-bg $(hostname -s | hexdump -en '\"#%06x\"'3 |-e cut'\"#%06x -c-7\"')"
This simple method will take the short hostname, convert the first three bytes to hex with hexdump, and uses that as the hex color for the background of the tmux status bar.
However, this isn't entirely ideal because most of the time your hostname is going to be in all lowercase and maybe some numbers. This means you'll always be in the same part of the color space. If you'd like a bit more variety in your colors, you can use this command:
run "tmux set -g status-bg $(hostname | md5sum | cut -c1-6 | xargs -n 1 printf \"#%s\")"
This command takes the complete hostname and calculates the md5sum to use the complete range of hex digits. It then uses cut to grab the first six output digits, and then xargs and printf to format it as a color. This not only sets the background by hostname, but also brings sufficient variety into the background colors - although there are times that it will select non-ideal colors.