Module: Vedeu::Presentation::Colour
- Included in:
- Vedeu::Presentation
- Defined in:
- lib/vedeu/output/presentation/colour.rb
Overview
Provides colour related presentation behaviour.
Instance Method Summary collapse
-
#background ⇒ Vedeu::Colours::Background
When the background colour for the model exists, return it, otherwise returns the parent background colour, or an empty Vedeu::Colours::Background.
-
#background=(value) ⇒ Vedeu::Colours::Background
Allows the setting of the background colour by coercing the given value into a Vedeu::Colours::Background colour.
- #colour ⇒ Vedeu::Colours::Colour
-
#colour=(value) ⇒ Vedeu::Colours::Colour
Allows the setting of the model’s colour by coercing the given value into a Vedeu::Colours::Colour.
-
#foreground ⇒ Vedeu::Colours::Foreground
When the foreground colour for the model exists, return it, otherwise returns the parent foreground colour, or an empty Vedeu::Colours::Foreground.
-
#foreground=(value) ⇒ Vedeu::Colours::Foreground
Allows the setting of the foreground colour by coercing the given value into a Vedeu::Colours::Foreground colour.
Instance Method Details
#background ⇒ Vedeu::Colours::Background
When the background colour for the model exists, return it, otherwise returns the parent background colour, or an empty Vedeu::Colours::Background.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/vedeu/output/presentation/colour.rb', line 14 def background @background ||= if colour colour.background elsif self.is_a?(Vedeu::Views::Char) && name interface.colour.background elsif parent parent.background else Vedeu::Colours::Background.new end end |
#background=(value) ⇒ Vedeu::Colours::Background
Allows the setting of the background colour by coercing the given value into a Vedeu::Colours::Background colour.
34 35 36 37 38 |
# File 'lib/vedeu/output/presentation/colour.rb', line 34 def background=(value) @colour = Vedeu::Colours::Colour.coerce( background: Vedeu::Colours::Background.coerce(value), foreground: colour.foreground) end |
#colour ⇒ Vedeu::Colours::Colour
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/vedeu/output/presentation/colour.rb', line 41 def colour @colour ||= if attributes[:colour] Vedeu::Colours::Colour.coerce(attributes[:colour]) elsif self.is_a?(Vedeu::Views::Char) && name Vedeu::Colours::Colour.coerce(interface.colour) elsif parent Vedeu::Colours::Colour.coerce(parent.colour) else Vedeu::Colours::Colour.new end end |
#colour=(value) ⇒ Vedeu::Colours::Colour
Allows the setting of the model’s colour by coercing the given value into a Vedeu::Colours::Colour.
61 62 63 |
# File 'lib/vedeu/output/presentation/colour.rb', line 61 def colour=(value) @colour = attributes[:colour] = Vedeu::Colours::Colour.coerce(value) end |
#foreground ⇒ Vedeu::Colours::Foreground
When the foreground colour for the model exists, return it, otherwise returns the parent foreground colour, or an empty Vedeu::Colours::Foreground.
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/vedeu/output/presentation/colour.rb', line 70 def foreground @foreground ||= if colour colour.foreground elsif self.is_a?(Vedeu::Views::Char) && name interface.colour.background elsif parent parent.foreground else Vedeu::Colours::Foreground.new end end |
#foreground=(value) ⇒ Vedeu::Colours::Foreground
Allows the setting of the foreground colour by coercing the given value into a Vedeu::Colours::Foreground colour.
90 91 92 93 94 |
# File 'lib/vedeu/output/presentation/colour.rb', line 90 def foreground=(value) @colour = attributes[:colour] = Vedeu::Colours::Colour.coerce( background: colour.background, foreground: Vedeu::Colours::Foreground.coerce(value)) end |