pjb3 (owner)

Revisions

gist: 129812 Download_button fork
public
Public Clone URL: git://gist.github.com/129812.git
Embed All Files: show embed
rgb_hex_to_dec.rb #
1
2
3
4
5
def rgb_hex_to_dec(rgb)
  if m = rgb.match(/#([a-zA-Z0-9]{2,})([a-zA-Z0-9]{2,})([a-zA-Z0-9]{2,})/)
    "%0.2f %0.2f %0.2f" % m.captures.map{|hex| hex.to_i(16) / 255.0}
  end
end