Skip to content

Instantly share code, notes, and snippets.

@russellbits
Created December 12, 2022 00:09
Show Gist options
  • Save russellbits/c7b515f3785aa3fc75a2a2208d5f8f47 to your computer and use it in GitHub Desktop.
Save russellbits/c7b515f3785aa3fc75a2a2208d5f8f47 to your computer and use it in GitHub Desktop.
Simple function to generate random rgb string of values
function genRGBString() {
const random256Color = (min, max) => min + Math.floor(Math.random() * (max - min + 1))
const r = random256Color(0, 255)
const g = random256Color(0, 255)
const b = random256Color(0, 255)
return `rgb(${r},${g},${b})`
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment