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
11 12 13 14 |
# File 'lib/axlsx/stylesheet/color.rb', line 11 def initialize( = {}) @rgb = "FF000000" end |
Instance Attribute Details
#auto ⇒ Boolean
Determines if the color is system color dependant
20 21 22 |
# File 'lib/axlsx/stylesheet/color.rb', line 20 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"
36 37 38 |
# File 'lib/axlsx/stylesheet/color.rb', line 36 def rgb @rgb end |
#tint ⇒ Float
valid values are between -1.0 and 1.0
The tint value.
45 46 47 |
# File 'lib/axlsx/stylesheet/color.rb', line 45 def tint @tint end |
Instance Method Details
#to_xml_string(str = '', tag_name = 'color') ⇒ String
Serializes the object
73 74 75 |
# File 'lib/axlsx/stylesheet/color.rb', line 73 def to_xml_string(str = '', tag_name = 'color') serialized_tag('' + tag_name + '', str) end |