title: Create unique colors using javascript
body: <p>What is the best way to pick random colors for a bar chart / histogram such that each color is different from the other.. and possibly in contrast</p>
  
  <p>The most talked about  way is</p>
  
  <pre><code>'#'+(Math.random()*0xFFFFFF&lt;&lt;0).toString(16);
  </code></pre>
  
  <p>but this can generate similar colors.. and sometimes distinguishing them might be a problem..
  Example
  <img src="https://i.stack.imgur.com/2BcHx.jpg" alt="enter image description here"></p>