cor aleatória
var randomColor = '#'+Math.floor(Math.random()*16777215).toString(16);
//generates a random color -> #56eec7
Smiling Snake
var randomColor = '#'+Math.floor(Math.random()*16777215).toString(16);
//generates a random color -> #56eec7
function getRandomColor() {
const availableCharacters = '0123456789ABCDEF';
const availableCharacterLength = availableCharacters.length;
let color = '#';
for (let i = 0; i < 6; i++) {
color += availableCharacters[Math.floor(Math.random() * availableCharacterLength)];
}
return color;
}
console.log(getRandomColor()); // #3BB46D
const generateRandomHexColor = () =>
`#${Math.floor(Math.random() * 0xffffff).toString(16)}`;
function randomColor(e){return '#'+Math.round(Math.random()*0xffffff).toString(16);}
randomColor(/*idk*/)