warna acak
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
private Color32 GetRandomColour32()
{
//using Color32
return new Color32(
(byte)UnityEngine.Random.Range(0, 255), //Red
(byte)UnityEngine.Random.Range(0, 255), //Green
(byte)UnityEngine.Random.Range(0, 255), //Blue
255 //Alpha (transparency)
);
}
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*/)