1function generateRandomColor() {
2 var letters = '0123456789ABCDEF';
3 var color = '#';
4 for (var i = 0; i < 6; i++) {
5 color += letters[Math.floor(Math.random() * 16)];
6 }
7 return color;
8}
9
10var randomColor=generateRandomColor();//"#F10531"
1var randomColor = '#'+Math.floor(Math.random()*16777215).toString(16);
2//generates a random color -> #56eec7
1function get_random_color()
2{
3 var color = "";
4 for(var i = 0; i < 3; i++) {
5 var sub = Math.floor(Math.random() * 256).toString(16);
6 color += (sub.length == 1 ? "0" + sub : sub);
7 }
8 return "#" + color;
9}
10
11function get_rand_color()
12{
13 var color = Math.floor(Math.random() * Math.pow(256, 3)).toString(16);
14 while(color.length < 6) {
15 color = "0" + color;
16 }
17 return "#" + color;
18}
19