Method: Cura::Color#initialize

Defined in:
lib/cura/color.rb

#initialize(r = 0, g = 0, b = 0, a = 255) ⇒ Color

Returns a new instance of Color.



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/cura/color.rb', line 45

def initialize(r=0, g=0, b=0, a=255)
  if r.respond_to?(:to_h)
    super(r.to_h)
  else
    @red   = r
    @green = g
    @blue  = b
    @alpha = a
  end

  # TODO: Update on rgb setters?
  rgb = [@red, @green, @blue]
  @lab = (RGB_TO_LAB_CACHE[rgb] ||= rgb_to_lab(rgb))
  # @lab = rgb_to_lab(rgb)
end