Class: Axlsx::Color
- Inherits:
-
Object
- Object
- Axlsx::Color
- Includes:
- OptionsParser, SerializedAttributes
- Defined in:
- lib/axlsx/stylesheet/color.rb
Overview
The color class represents a color used for borders, fills an fonts
Instance Attribute Summary collapse
-
#auto ⇒ Boolean
Determines if the color is system color dependant.
-
#rgb ⇒ String
The color as defined in rgb terms.
-
#tint ⇒ Float
The tint value.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Color
constructor
Creates a new Color object.
-
#to_xml_string(str = '', tag_name = 'color') ⇒ String
Serializes the object.
Methods included from SerializedAttributes
#declared_attributes, included, #serialized_attributes, #serialized_element_attributes, #serialized_tag
Methods included from OptionsParser
Constructor Details
#initialize(options = {}) ⇒ Color
Creates a new Color object
13 14 15 16 |
# File 'lib/axlsx/stylesheet/color.rb', line 13 def initialize(={}) @rgb = "FF000000" end |
Instance Attribute Details
#auto ⇒ Boolean
Determines if the color is system color dependant
22 23 24 |
# File 'lib/axlsx/stylesheet/color.rb', line 22 def auto @auto end |
#rgb ⇒ String
rgb colors need to conform to ST_UnsignedIntHex. That basically means put 'FF' before you color
The color as defined in rgb terms. When assigning the rgb value the behavior is much like CSS selectors and can use shorthand versions as follows: If you provide a two character value it will be repeated for each r, g, b assignment If you provide data that is not 2 characters in length, and is less than 8 characters it will be padded with "F"
38 39 40 |
# File 'lib/axlsx/stylesheet/color.rb', line 38 def rgb @rgb end |
#tint ⇒ Float
valid values are between -1.0 and 1.0
The tint value.
47 48 49 |
# File 'lib/axlsx/stylesheet/color.rb', line 47 def tint @tint end |
Instance Method Details
#to_xml_string(str = '', tag_name = 'color') ⇒ String
Serializes the object
72 73 74 |
# File 'lib/axlsx/stylesheet/color.rb', line 72 def to_xml_string(str = '', tag_name = 'color') serialized_tag('' + tag_name + '', str) end |