Class: OoxmlParser::ThemeColors

Inherits:
Object
  • Object
show all
Defined in:
lib/ooxml_parser/common_parser/common_data/colors/theme_colors.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.listHash

Returns list of colors.

Returns:

  • (Hash)

    list of colors



6
7
8
# File 'lib/ooxml_parser/common_parser/common_data/colors/theme_colors.rb', line 6

def list
  @list
end

Class Method Details

.parse_color_theme(theme, tint) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/ooxml_parser/common_parser/common_data/colors/theme_colors.rb', line 8

def parse_color_theme(theme, tint)
  themes_array = ThemeColors.list.to_a
  # TODO: if no swap performed - incorrect color parsing. But don't know why it needed
  themes_array[0], themes_array[1] = themes_array[1], themes_array[0]
  themes_array[2], themes_array[3] = themes_array[3], themes_array[2]
  hls = HSLColor.rgb_to_hsl(themes_array[theme][1])
  tint = 0 if tint.nil?
  hls.calculate_rgb_with_tint(tint)
end