Sha256: 5d19a4861a4f0e04f20991307b27ef47dd4df4129b5f550f8305cfca27fa89f9

Contents?: true

Size: 816 Bytes

Versions: 5

Compression:

Stored size: 816 Bytes

Contents

# frozen_string_literal: true

module OoxmlParser
  # Class for hold ThemeColors list
  class ThemeColors < OOXMLDocumentObject
    # @return [Hash] list of colors
    attr_accessor :list

    # Parse color theme
    # @param theme [String] name of theme
    # @param tint [Integer] tint of theme
    # @return [Color] color of theme
    def parse_color_theme(theme, tint)
      themes_array = root_object.theme.color_scheme.values
      # 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].color)
      tint = 0 if tint.nil?
      hls.calculate_rgb_with_tint(tint)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ooxml_parser-0.8.1 lib/ooxml_parser/common_parser/common_data/colors/theme_colors.rb
ooxml_parser-0.8.0 lib/ooxml_parser/common_parser/common_data/colors/theme_colors.rb
ooxml_parser-0.7.2 lib/ooxml_parser/common_parser/common_data/colors/theme_colors.rb
ooxml_parser-0.7.1 lib/ooxml_parser/common_parser/common_data/colors/theme_colors.rb
ooxml_parser-0.7.0 lib/ooxml_parser/common_parser/common_data/colors/theme_colors.rb