Created
December 12, 2022 00:09
-
-
Save russellbits/c7b515f3785aa3fc75a2a2208d5f8f47 to your computer and use it in GitHub Desktop.
Simple function to generate random rgb string of values
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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