Created
October 21, 2015 16:15
-
-
Save msiegenthaler/cf3dc277fa5685ac2a62 to your computer and use it in GitHub Desktop.
Random color with Coffeescript
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
# Generates random color such as #f0d3a2 | |
getRandomColor = () -> | |
letters = '0123456789ABCDEF'.split('') | |
color = '#' | |
for i in [0..5] | |
color += letters[Math.floor(Math.random() * 16)] | |
color |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment