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.



34
35
36
37
# File 'lib/rainbow/color.rb', line 34

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

Instance Attribute Details

#numObject (readonly)

Returns the value of attribute num.



32
33
34
# File 'lib/rainbow/color.rb', line 32

def num
  @num
end

Instance Method Details

#codesObject



39
40
41
42
43
# File 'lib/rainbow/color.rb', line 39

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

  [code]
end