Litmus

to generate a new and unique variation

Source Code

Every variart piece is open source, you can see exactly how it is drawn from the code.

// background (#F0E8E0)
var g = s.gradient("r(0.5, 0.5, 0.5)#f0e8e0-#ddd6ce");
s.rect(0, 0, width, height).attr({fill: g})

// colors
var pinks   = ['#D07C96', '#DC0657', '#86104C'];
var reds    = ['#C41420', '#DE4A00', '#DA1C14'];
var greens  = ['#B9D55D', '#28A362', '#2B773B'];
var blues   = ['#2F99BB', '#33AB90', '#206691'];
var yellows = ['#E8BA00', '#E6E600', '#F0EB00'];

var leftMargin = 100;
var spaceBetween = 25;
var boxSize = 40;

function strip(x, numCells, width, colors){
  var lastColor, color;
  
  for(var i = 0; i < numCells; i++){
    // ensure we don't have the same color side-by-side
    while (color == null || color == lastColor){
      color = colors[(i + getRandomInt(0, 10)) % 3];  
    }    
    
    s.rect(x, 90 + i * width, width, width).attr({
      fill: color
    });
    lastColor = color;
  }
}

// strips
strip((boxSize * 0) + leftMargin + (spaceBetween * 0), 8, boxSize, pinks);
strip((boxSize * 1) + leftMargin + (spaceBetween * 1), 8, boxSize, reds);
strip((boxSize * 2) + leftMargin + (spaceBetween * 2), 8, boxSize, greens);
strip((boxSize * 3) + leftMargin + (spaceBetween * 3), 8, boxSize, blues);
strip((boxSize * 4) + leftMargin + (spaceBetween * 4), 8, boxSize, yellows);