Categories
Generates a random hex color.
Contributed by @ditinagrawal
function randomHexColor() { return `#${Math.floor(Math.random() * 0xffffff) .toString(16) .padStart(6, "0") .toUpperCase()}`; }
randomHexColor(); // Example: #A1B2C3