In my current project of programming a screen saver using JavaScript, I am facing the challenge of creating lines that are solid enough to be visible, yet transparent enough to reveal a pattern as they are drawn. I have successfully implemented a random color generator with hex colors. However, I am struggling to figure out how to set the transparency level consistently while keeping everything else random. Is there a way to achieve this? If so, how can it be done?
Below is the code snippet for generating random colors:
function getRandomColor()
{
var letters = '0123456789ABCDEF';
var color = '#';
for (var i = 0; i < 6; i++)
{
color += letters[Math.floor(Math.random() * 16)];
}
return color;
}