title: Hash string into RGB color
body: <p>Is there a best practice on how to hash an arbitrary string into a RGB color value? Or to be more general: to 3 bytes.</p>
  
  <p>You're asking: When will I ever need this? It doesn't matter to me, but imagine those tube graphs on any GitHub <a href="https://github.com/CocoaPods/Specs/network" rel="noreferrer" title="Network page for CocoaPods/Specs">network page</a>. There you can see something like this:</p>
  
  <p><img src="https://i.stack.imgur.com/w0pFx.png" alt="git branches"></p>
  
  <p>Where every colored line means a distinct git branch. The low tech approach to color these branches would be a CLUT (color lookup table). The more sophisticated version would be:</p>
  
  <pre><code>$branchColor = hashStringToColor(concat($username,$branchname));
  </code></pre>
  
  <p>Because you want a static color every time you see the branches representation. And for bonus points: How do you ensure an even color distribution of that hash function?</p>
  
  <p>So the answer to my question boils down to the implementation of <code>hashStringToColor()</code>.</p>