Created
August 11, 2017 16:25
-
-
Save electerious/46ae766fa7ba6262d3203efba756aeb3 to your computer and use it in GitHub Desktop.
Generate a random hsl color
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
const randomColor = () => { | |
const random = (min, max) => Math.random() * (max - min) + min | |
const h = Math.floor(random(0, 360)) | |
const s = Math.floor(random(50, 100)) | |
const l = Math.floor(random(50, 100)) | |
return `hsl(${ h }, ${ s }%, ${ l }%)` | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example: