Reggie B. – A Hex/RGB Color Converter
Description
This is not the gem that you want. You want the full-featured “color” Ruby gem.
You’re still here? Okay, this is what this gem is all about:
Reggie B. is a utility for converting colors between rgb and hex format. It was created to support www.2rgb.com. It is especially useful for handling CSS color formats.
Examples
ReggieB.convert "rgb(255, 255, 255)" => "0xffffff"
ReggieB.convert "255, 255, 255" => "0xffffff"
ReggieB.convert "rgb(100%, 100%, 100%)" => "0xffffff"
ReggieB.convert "0xffffff" => [255, 255, 255]
ReggieB.convert "#ffffff" => [255, 255, 255]
ReggieB.convert "#fff" => [255, 255, 255]