class String
Public Instance Methods
to_rgb()
click to toggle source
simple (and naive) way to convert html-hex color to array of colors
# File lib/dm_core/scio_excel.rb, line 493 def to_rgb raise "Invalid Hex Color" if self.size != 7 || self[0] != 35 rgb = Hash.new rgb[:red] = self[1,2].to_i(16) rgb[:green] = self[3,2].to_i(16) rgb[:blue] = self[5,2].to_i(16) rgb end