Created
October 7, 2014 11:16
-
-
Save vitvad/e84b2929fef38927a4bb to your computer and use it in GitHub Desktop.
generate random color pair for paceholde.it
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getPair(num) { | |
var randColor = function(){ | |
var rnd = Math.random(); | |
var color = Math.floor(rnd * 16777215).toString(16); | |
var oposite = Math.floor(16777215 - rnd * 16777215).toString(16); | |
while (oposite.length < 6) { | |
oposite = '0' + oposite; | |
} | |
return color +'/'+ oposite; | |
} | |
var txt = '', | |
xx = 0; | |
while (xx < num) { | |
xx++; | |
txt += randColor() + '\n'; | |
} | |
return txt; | |
} | |
getPair(10); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment