Skip to content

Instantly share code, notes, and snippets.

@benjamingwynn
Last active October 19, 2022 13:54
Show Gist options
  • Save benjamingwynn/077ae8841512473753f60b1cdf142b60 to your computer and use it in GitHub Desktop.
Save benjamingwynn/077ae8841512473753f60b1cdf142b60 to your computer and use it in GitHub Desktop.
Generate a random hexadecimal colour in Javascript
function generateRandomColour () {
return '#'+(Math.random() * 0xffffff | 0).toString(16).padStart(6, '0')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment