Class: Rainbow::Color::X11Named

Inherits:
RGB show all
Includes:
X11ColorNames
Defined in:
lib/rainbow/color.rb

Constant Summary

Constants included from X11ColorNames

X11ColorNames::NAMES

Instance Attribute Summary

Attributes inherited from RGB

#b, #g, #r

Attributes inherited from Indexed

#num

Attributes inherited from Rainbow::Color

#ground

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from RGB

#codes, to_ansi_domain

Methods inherited from Indexed

#codes

Methods inherited from Rainbow::Color

build, parse_hex_color

Constructor Details

#initialize(ground, name) ⇒ X11Named

Returns a new instance of X11Named.



127
128
129
130
131
132
133
134
# File 'lib/rainbow/color.rb', line 127

def initialize(ground, name)
  unless X11Named.color_names.include?(name)
    fail ArgumentError,
      "Unknown color name, valid names: #{X11Named.color_names.join(', ')}"
  end

  super(ground, *NAMES[name])
end

Class Method Details

.color_namesObject



123
124
125
# File 'lib/rainbow/color.rb', line 123

def self.color_names
  NAMES.keys
end