Why not make your own color generator ๐?
Method 1 - Long method
// Generate random color in hex format
const randomColor = () => {
const letters = "0123456789ABCDEF";
let color = "#";
for (let i = 0; i < 6; i++) {
color += letters[Math.floor(Math.random() * 16)];
}
return color;
}
Method 2 - Short and Best Method
const randomColor = Math.floor(Math.random()*16777215).toString(16);
console.log("#" + randomColor)
Thank you for reading, have a nice day!
- Follow me on Twitter - @codewithsnowbit
- Subscribe me on YouTube - Code With SnowBit
ย