title: Generate color palette using JavaScript
body: <p>I want to generate a color palette of every 5th, 15th,17th or 51th RGB-value.</p>
  
  <p>Something like this:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta charset="utf-8" /&gt;
  &lt;title&gt;Color Palette&lt;/title&gt;
  &lt;style type="text/css"&gt;
  div{margin:0;width:20px;height:20px;float:left}
  .clear{clear:both}
  &lt;/style&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;script&gt;
  var r = 0,
      g = 0,
      b = 0;
  
  function createBr() {
      var b = document.createElement('br');
      b.style.clear = 'both';
      document.body.appendChild(b);
  }
  
  function createDiv(r,g,b) {
  var a = document.createElement('div');
  a.style.background = 'rgb(' + r + ',' + g + ',' + b + ')';
  document.body.appendChild(a);
  }
  
  
  function createColorPalette(value) {
  var v = 255/value;
      for(i = 0; i &lt; v; i++) {
          r = r + value;
          g = g + value;
          b = b + value;
          createDiv(r,g,b);
      }
  createBr();
  }
  
  // put in 5,15,17 or 51 as value below
  window.onload = createColorPalette(17);
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I'm not smart enough to figure out how to generate all the 3375 colors with a small script. Any ideas how to do that?</p>