Created
November 6, 2019 14:22
-
-
Save Gaboso/a2879f41d95d8b445040a455406a3e75 to your computer and use it in GitHub Desktop.
Random RGB Color JS
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 getRandorColorNumber() { | |
let randomNumber = Math.random() * 255; | |
return Math.round(randomNumber); | |
} | |
function randomRGBA() { | |
let r = getRandorColorNumber(); | |
let g = getRandorColorNumber(); | |
let b = getRandorColorNumber(); | |
let a = Math.random.toFixed(1); | |
return 'rgba(' + r + ',' + g + ',' + b + ',' + a + ')'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment