Class: Uniword::Themes::ColorScheme
- Inherits:
-
Lutaml::Model::Serializable
- Object
- Lutaml::Model::Serializable
- Uniword::Themes::ColorScheme
- Defined in:
- lib/uniword/themes/theme.rb
Overview
Friendly Color Scheme - simplified color model
Represents colors as simple hex values, abstracting away OOXML complexity.
Constant Summary collapse
- KEY_ALIASES =
Key name aliases (maps snake_case to camelCase)
{ fol_hlink: "folHlink", }.freeze
Instance Method Summary collapse
-
#[](key) ⇒ String?
Convenience accessor for colors hash Handles both snake_case (:fol_hlink) and camelCase (‘folHlink’) keys.
-
#[]=(key, value) ⇒ Object
Convenience setter for colors hash.
Instance Method Details
#[](key) ⇒ String?
Convenience accessor for colors hash Handles both snake_case (:fol_hlink) and camelCase (‘folHlink’) keys
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/uniword/themes/theme.rb', line 37 def [](key) key_str = key.to_s # Try exact match first result = colors&.[](key.to_sym) || colors&.[](key_str) return result if result # Try alias mapping if (aliased = KEY_ALIASES[key.to_sym]) colors&.[](aliased.to_sym) || colors&.[](aliased) end end |
#[]=(key, value) ⇒ Object
Convenience setter for colors hash
53 54 55 56 |
# File 'lib/uniword/themes/theme.rb', line 53 def []=(key, value) self.colors ||= {} colors[key.to_sym] = value end |