Module: Cura::Attributes::HasColors

Includes:
HasAttributes
Included in:
Component::Base
Defined in:
lib/cura/attributes/has_colors.rb

Overview

Adds the #foreground and #background attributes. TODO: Should be color and background… HasBackground and HasColor

Instance Method Summary collapse

Methods included from HasAttributes

included, #update_attributes

Instance Method Details

#backgroundColor

Get the background color of this object.

Returns:



# File 'lib/cura/attributes/has_colors.rb', line 38

#background=(value) ⇒ Color

Set the background color of this object.

Parameters:

Returns:



49
# File 'lib/cura/attributes/has_colors.rb', line 49

attribute(:background) { |value| validate_color_attribute(value) }

#foregroundColor

Get the foreground color of this object.

Returns:



# File 'lib/cura/attributes/has_colors.rb', line 25

#foreground=(value) ⇒ Color

Set the foreground color of this object.

Parameters:

Returns:



36
# File 'lib/cura/attributes/has_colors.rb', line 36

attribute(:foreground) { |value| validate_color_attribute(value) }

#initialize(attributes = {}) ⇒ Object



18
19
20
21
22
23
# File 'lib/cura/attributes/has_colors.rb', line 18

def initialize(attributes={})
  @foreground = :inherit unless instance_variable_defined?(:@foreground)
  @background = :inherit unless instance_variable_defined?(:@background)
  
  super
end