I am trying to randomly generate a color in hex in javascript.
However the colors generated are almost indistinguishable from eachother. Is there a way to improv
Try this:
function getRandomColor() { var letters = '0123456789ABCDEF'.split(''); var color = '#'; for (var i = 0; i < 6; i++ ) { color += letters[Math.round(Math.random() * 15)]; } return color; }
See it in action: http://jsfiddle.net/3wjgG/1/