Last Updated: February 25, 2016
·
524
· sstarr

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.