class Spreadsheet::Excel::Rgb
Attributes
b[RW]
g[RW]
r[RW]
Public Class Methods
new(r,g,b)
click to toggle source
# File lib/spreadsheet/excel/rgb.rb, line 107 def initialize(r,g,b) @r = r & 0xff @g = g & 0xff @b = b & 0xff end
to_rgb(color_symbol)
click to toggle source
# File lib/spreadsheet/excel/rgb.rb, line 101 def self.to_rgb color_symbol col = @@RGB_MAP[color_symbol] return Rgb.new(col >> 16, (col & 0xff00) >> 8, col & 0xff) if col nil end
Public Instance Methods
as_hex()
click to toggle source
# File lib/spreadsheet/excel/rgb.rb, line 117 def as_hex to_i.to_s(16) end
to_i()
click to toggle source
# File lib/spreadsheet/excel/rgb.rb, line 113 def to_i (r * (256 * 256)) + (g * 256) + b end