Module: RubyXL::ColorConvenienceMethods

Included in:
Color
Defined in:
lib/rubyXL/convenience_methods.rb

Instance Method Summary collapse

Instance Method Details

#get_rgb(workbook) ⇒ Object



1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
# File 'lib/rubyXL/convenience_methods.rb', line 1149

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