Create a random (yet valid) hex colour value in Ruby
colour = "##{((0..6).map{rand(256).chr}*'').unpack('H*')[0][0,6]}"
# => "#9ee5a3"
WARNING: May produce colours offensive to people with eyes.
Written by Simon Starr
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#