Skip to content

Instantly share code, notes, and snippets.

@steven-work-space
Created October 10, 2017 22:44
Show Gist options
  • Save steven-work-space/3f99ba5cdd0e6fc9cf697d8d8c01b2a2 to your computer and use it in GitHub Desktop.
Save steven-work-space/3f99ba5cdd0e6fc9cf697d8d8c01b2a2 to your computer and use it in GitHub Desktop.
Getting a random color in Hex format
function getRandomColor() {
myColors = new Array("0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F");
randomColor = "#";
for(let i = 0; i < 6; i++) {
randomColor += myColors[Math.floor(Math.random() * myColors.length)];
}
return randomColor;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment