Class: Uniword::Mhtml::Theme

Inherits:
Lutaml::Model::Serializable
  • Object
show all
Defined in:
lib/uniword/mhtml/theme.rb

Overview

MHTML-specific Theme class

This is SEPARATE from OOXML DrawingML Theme. MHTML uses HTML/CSS for styling, not OOXML theme parts.

This class represents theme information extracted from MHTML documents and provides HTML/CSS output for MHTML serialization.

Instance Method Summary collapse

Instance Method Details

#color(name) ⇒ String?

MHTML-specific: Get theme color for CSS

Parameters:

  • name (String)

    Color name

Returns:

  • (String, nil)

    Color value



37
38
39
# File 'lib/uniword/mhtml/theme.rb', line 37

def color(name)
  colors[name.to_s]
end

#font(name) ⇒ String?

MHTML-specific: Get theme font for CSS

Parameters:

  • name (String)

    Font name

Returns:

  • (String, nil)

    Font family



45
46
47
# File 'lib/uniword/mhtml/theme.rb', line 45

def font(name)
  fonts[name.to_s]
end

#to_cssString

MHTML-specific: Convert theme to CSS variables

Returns:

  • (String)

    CSS with theme variables



22
23
24
25
26
27
28
29
30
31
# File 'lib/uniword/mhtml/theme.rb', line 22

def to_css
  css = +""
  colors.each do |name, value|
    css << "--#{name}: #{value};\n"
  end
  fonts.each do |name, value|
    css << "--font-#{name}: #{value};\n"
  end
  css
end