Created
October 11, 2023 18:39
-
-
Save jonasmello/102b12c4524eba92b9e5a031cab70914 to your computer and use it in GitHub Desktop.
Gerador de Cores e Imagem para placeholder
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 a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 'A', 'B', 'C', 'D', 'E', 'F']; | |
const genCol = (length = 6) => { | |
let text = ''; | |
if (length > 1) { | |
for (let i = 0; i < length; i++) { | |
text += `${a[Math.floor(Math.random() * 15)]}`; | |
} | |
} | |
return text; | |
}; | |
const genImg = () => | |
`https://dummyimage.com/${200 + Math.floor(Math.random() * 200 + 1)}x${ | |
200 + Math.floor(Math.random() * 200 + 1) | |
}/${genCol()}/${genCol()}`; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment