Created
March 11, 2022 10:26
-
-
Save AitorAlejandro/de256088e9cad9b2921a88f4b1a31227 to your computer and use it in GitHub Desktop.
Generates a random hex 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 randomHexColor = (): string => `#${Math.floor(Math.random() * 0xffffff).toString(16).padEnd(6, '0')}`; | |
randomHexColor(); // -> #dc7c40 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment