By utilizing the following function, I am able to create random colors:
function getRandomColor() {
var letters = '0123456789ABCDEF'.split('');
var color = '#';
for (var i = 0; i < 6; i++) {
color += letters[Math.round(Math.random() * 15)];
}
return color;
}
However, I have a requirement to exclude "#A9A9A9" or any shades of grey from the generated colors. Simply adding an if condition after generating the color and calling the function again does not appear to be an efficient solution. Can you provide suggestions on how this can be achieved?