Skip to content

Instantly share code, notes, and snippets.

@michiel
Created March 25, 2013 20:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michiel/5240409 to your computer and use it in GitHub Desktop.
Save michiel/5240409 to your computer and use it in GitHub Desktop.
Random hex color value in CoffeeScript
# Random hex color value in CoffeeScript
randomHexColor = (len=3)->
pattern = '0123456789ABCDEF'.split ''
str = '#'
for i in [1..len]
str += pattern[Math.round(Math.random() * pattern.length)]
str
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment