Using the RGB gem to convert hex to RGB and more

require 'rgb'

# Supported input data color formas:
color = RGB::Color.from_rgb_hex("#333333")
color = RGB::Color.from_rgb_hex(0xFF0000)
color.to_rgb #=> [255, 0, 0]

Resources