Skip to content

Instantly share code, notes, and snippets.

@sstarr
Created October 15, 2013 17:54
Show Gist options
  • Save sstarr/6995732 to your computer and use it in GitHub Desktop.
Save sstarr/6995732 to your computer and use it in GitHub Desktop.
Generate a random hex colour value in Ruby. WARNING: May produce colours offensive to people with eyes.
colour = "##{((0..6).map{rand(256).chr}*'').unpack('H*')[0][0,6]}"
# => "#9ee5a3"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment