How can I generate a random hex color with ruby?
One-liner with unpack: Random.new.bytes(3).unpack("H*")[0]
unpack
Random.new.bytes(3).unpack("H*")[0]
Since ruby 2.6.0 you can do it even shorter: Random.bytes(3).unpack1('H*')
Random.bytes(3).unpack1('H*')