Snippet
randomRGB()
edit
const random255 = () => Math.floor(Math.random() * 255)
const randomRGB = () => {
const r = random255()
const g = random255()
const b = random255()
return `rgb(${r}, ${g}, ${b})`
}
const randomRGBA = () => {
const r = random255()
const g = random255()
const b = random255()
const a = Math.random()
return `rgb(${r}, ${g}, ${b}, ${a})`
}
Liked the post?
Give the author a dopamine boost with a few "beard strokes". Click the beard
up to 50 times to show your appreciation.
Kyle Shevlin is the founder & lead software engineer of Agathist, a software development firm with a mission to build good software with good people.