Module: RubyXL::ColorConvenienceMethods

Defined in:
lib/rubyXL/convenience_methods/color.rb

Instance Method Summary collapse

Instance Method Details

#get_rgb(workbook) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/rubyXL/convenience_methods/color.rb', line 3

def get_rgb(workbook)
  if rgb then
    return rgb
  elsif theme then
    theme_color = workbook.theme.get_theme_color(theme)
    rgb_color = theme_color && theme_color.a_srgb_clr
    color_value = rgb_color && rgb_color.val
    return nil if color_value.nil?

    RubyXL::RgbColor.parse(color_value).to_hls.apply_tint(tint).to_rgb.to_s
  end
end