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.



47
48
49
50
# File 'lib/rainbow/color.rb', line 47

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

Instance Attribute Details

#numObject (readonly)

Returns the value of attribute num.



45
46
47
# File 'lib/rainbow/color.rb', line 45

def num
  @num
end

Instance Method Details

#codesObject



52
53
54
55
56
# File 'lib/rainbow/color.rb', line 52

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

  [code]
end