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 36

#background=(value) ⇒ Color

Set the background color of this object.

Parameters:

Returns:



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

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

#foregroundColor

Get the foreground color of this object.

Returns:



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

#foreground=(value) ⇒ Color

Set the foreground color of this object.

Parameters:

Returns:



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

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

#initialize(attributes = {}) ⇒ Object



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

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

  super
end