Stupid little snippet to generate random colours
0
random-colour-generator.js
8 lines 396 B view raw
1// about:blank 2const colour = (r, g, b) => `#${r.toString(16).padStart(2, "0")}${g.toString(16).padStart(2, "0")}${b.toString(16).padStart(2, "0")}` 3const randomRgb = () => [0, 0, 0].map(() => Math.floor(Math.random() * 255)) 4 5// then run when you want a new colour 6 7document.body.style.backgroundColor = colour(...randomRgb()) 8// get the colour either through browser logs or via inspect element