Class: Color
- Inherits:
-
Struct
- Object
- Struct
- Color
- Defined in:
- lib/color.rb
Instance Attribute Summary collapse
-
#a ⇒ Object
Returns the value of attribute a.
-
#b ⇒ Object
Returns the value of attribute b.
-
#g ⇒ Object
Returns the value of attribute g.
-
#r ⇒ Object
Returns the value of attribute r.
Instance Method Summary collapse
Instance Attribute Details
#a ⇒ Object
Returns the value of attribute a
1 2 3 |
# File 'lib/color.rb', line 1 def a @a end |
#b ⇒ Object
Returns the value of attribute b
1 2 3 |
# File 'lib/color.rb', line 1 def b @b end |
#g ⇒ Object
Returns the value of attribute g
1 2 3 |
# File 'lib/color.rb', line 1 def g @g end |
#r ⇒ Object
Returns the value of attribute r
1 2 3 |
# File 'lib/color.rb', line 1 def r @r end |
Instance Method Details
#rgb ⇒ Object
2 3 4 |
# File 'lib/color.rb', line 2 def rgb [r, g, b] end |
#rgba_format ⇒ Object
6 7 8 |
# File 'lib/color.rb', line 6 def rgba_format "rgba(" + (rgb.map(&:percentify) << a.value).join(", ") + ")" end |