1const r = Math.round (Math.random () * 255);
2const g = Math.round (Math.random () * 255);
3const b = Math.round (Math.random () * 255);
4
5// some examples on where and how to use it
6config.data.datasets.borderColor = `rgb (${r}, ${g}, ${b})`;
7config.data.datasets.backgroundColor = `rgb (${r}, ${g}, ${b})`;
8config.options.scales.yAxes.ticks.fontColor = `rgb(${r}, ${g}, ${b})`;
1 function getRandomColor() {
2 var letters = '0123456789ABCDEF'.split('');
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