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(color_theme_node) ⇒ Object



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

def parse_color_theme(color_theme_node)
  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[color_theme_node.attribute('theme').value.to_i][1])
  tint = 0
  unless color_theme_node.attribute('tint').nil?
    tint = color_theme_node.attribute('tint').value.to_f
  end
  hls.calculate_rgb_with_tint(tint)
end