Class: Rainbow::Color::Indexed

Inherits:
Rainbow::Color show all
Defined in:
lib/rainbow/color.rb

Direct Known Subclasses

Named, RGB

Instance Attribute Summary collapse

Attributes inherited from Rainbow::Color

#ground

Instance Method Summary collapse

Methods inherited from Rainbow::Color

build, parse_hex_color

Constructor Details

#initialize(ground, num) ⇒ Indexed

Returns a new instance of Indexed.



57
58
59
60
# File 'lib/rainbow/color.rb', line 57

def initialize(ground, num)
  @ground = ground
  @num = num
end

Instance Attribute Details

#numObject (readonly)

Returns the value of attribute num.



55
56
57
# File 'lib/rainbow/color.rb', line 55

def num
  @num
end

Instance Method Details

#codesObject



62
63
64
65
66
# File 'lib/rainbow/color.rb', line 62

def codes
  code = num + (ground == :foreground ? 30 : 40)

  [code]
end