milkbikis/powerline-shell — pull request #82 by hryanjones (2013-07-20 14:59:17+00:00)
Title: Uniquely colorize hostname based on a hash`

Many times I find myself sshed into 2+ computers and I sometimes will make mistakes because I don't realize which one I'm on. In order to combat this forgetfulness I wrote a new segment...

(ideally it should probably be the same as the normal hostname.py segment,
but I didn't see a quick way to send the module an option)

...which:
1) gets hostname and passes it through md5sum
2) taking the end 6 hex digits -> convert to RGB
3) convert that to HLS and do a bit of magic to find another color which likely won't conflict
4) lookup the correct terminal code for these two colors and set them as FG and BG

I also did a fair amount of testing (see image below) to make sure the function worked and didn't generate anything super unreadable. I'll probably be using this and committing to it as time goes on and I'd be glad to hear what you think.

Thanks,
Ryan

![test_of_many_colors](https://f.cloud.github.com/assets/2705396/830395/c2dc30cc-f14c-11e2-9eb5-f88d5e8dee05.png)