Created
November 25, 2022 03:06
-
-
Save daffodilistic/0d260f46aa7184ae92d867bda7f7ad38 to your computer and use it in GitHub Desktop.
Lazy JavaScript Random Color
This file contains 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 getRandomColor(excludeHex) { | |
let rgb = [ 255, 255, 255 ]; | |
return `${excludeHex ? '' : '#'}${rgb.map(x => Math.floor(Math.random() * 255 + 1).toString(16)).join("")}`; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment