Created
October 16, 2015 21:58
-
-
Save patricknelson/f22d33b2d788a756e32d to your computer and use it in GitHub Desktop.
Generate random hex color, for fun.
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 randColor() { | |
var color = "#"; | |
for(var i = 1; i <= 3; i++ ) { | |
var num = Math.round(Math.random() * 255); | |
color += num.toString(16); | |
} | |
return color; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment