Last active
September 7, 2021 23:08
-
-
Save jamiejohnsonkc/45f42efc71f698b5d6573599bbf783c1 to your computer and use it in GitHub Desktop.
js generate random colors
This file contains 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 getRandomColor() { | |
var letters = '0123456789ABCDEF'; | |
var color = '#'; | |
for (var i = 0; i < 6; i++) { | |
color += letters[Math.floor(Math.random() * 16)]; | |
} | |
return color; | |
} | |
function setRandomColor() { | |
$("#colorpad").css("background-color", getRandomColor()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment