generate random dark color javascript code example
Example 1: javascript random color generator
function generateRandomColor() {
var letters = '0123456789ABCDEF';
var color = '#';
for (var i = 0; i < 6; i++) {
color += letters[Math.floor(Math.random() * 16)];
}
return color;
}
var randomColor=generateRandomColor();
Example 2: random light color js
function getRandomColor() {
var letters = 'BCDEF'.split('');
var color = '#';
for (var i = 0; i < 6; i++ ) {
color += letters[Math.floor(Math.random() * letters.length)];
}
return color;
}