Class: Axlsx::Color
- Inherits:
-
Object
- Object
- Axlsx::Color
- Defined in:
- lib/axlsx/stylesheet/color.rb
Overview
The color class represents a color used for borders, fills an fonts
Instance Attribute Summary (collapse)
-
- (Boolean) auto
Determines if the color is system color dependant.
-
- (String) rgb
The color as defined in rgb terms.
-
- (Float) tint
The tint value.
Instance Method Summary (collapse)
-
- (Color) initialize(options = {})
constructor
Creates a new Color object.
-
- (String) to_xml(xml)
Serializes the color.
Constructor Details
- (Color) initialize(options = {})
Creates a new Color object
34 35 36 37 38 39 |
# File 'lib/axlsx/stylesheet/color.rb', line 34 def initialize(={}) @rgb = "FF000000" .each do |o| self.send("#{o[0]}=", o[1]) if self.respond_to? o[0] end end |
Instance Attribute Details
- (Boolean) auto
Determines if the color is system color dependant
6 7 8 |
# File 'lib/axlsx/stylesheet/color.rb', line 6 def auto @auto end |
- (String) rgb
Note:
rgb colors need to conform to ST_UnsignedIntHex. That basically means put ‘FF’ before you color
The color as defined in rgb terms.
19 20 21 |
# File 'lib/axlsx/stylesheet/color.rb', line 19 def rgb @rgb end |
- (Float) tint
Note:
valid values are between -1.0 and 1.0
The tint value.
28 29 30 |
# File 'lib/axlsx/stylesheet/color.rb', line 28 def tint @tint end |
Instance Method Details
- (String) to_xml(xml)
Serializes the color
55 |
# File 'lib/axlsx/stylesheet/color.rb', line 55 def to_xml(xml) xml.color(self.instance_values) end |