I have this method to generate me random colors for font:
function getRandomRolor() {
var letters = \'0123456789ABCDEF\'.split(\'\');
var color = \'#
Take any random digit from 0-5
as the first digit of your color and then choose the rest of the five digits using your above code.
JS Fiddle: http://jsfiddle.net/xP5v8/
var color,
letters = '0123456789ABCDEF'.split('')
function AddDigitToColor(limit)
{
color += letters[Math.round(Math.random() * limit )]
}
function GetRandomColor() {
color = '#'
AddDigitToColor(5)
for (var i = 0; i < 5; i++) {
AddDigitToColor(15)
}
return color
}