Class: Nineteen::Eighty::Two::Colours
- Inherits:
-
Object
- Object
- Nineteen::Eighty::Two::Colours
- Defined in:
- lib/nineteen/eighty/two/colours.rb
Constant Summary collapse
- PRIMARIES =
YAML.load_file File.join File.dirname(__FILE__), '..', '..', '..', '..', 'config', 'colours.yml'
- BLACK =
0
- YELLOW =
RED + GREEN
- CYAN =
GREEN + BLUE
- MAGENTA =
RED + BLUE
- WHITE =
RED + GREEN + BLUE
Class Method Summary collapse
Class Method Details
.[](key) ⇒ Object
17 18 19 20 21 |
# File 'lib/nineteen/eighty/two/colours.rb', line 17 def self.[] key hex = "%06x" % (self.const_get key.upcase) return brighten hex if key.upcase == key hex end |
.brighten(colour) ⇒ Object
37 38 39 |
# File 'lib/nineteen/eighty/two/colours.rb', line 37 def self.brighten colour colour.gsub 'b', 'f' end |
.method_missing(m, *args) ⇒ Object
33 34 35 |
# File 'lib/nineteen/eighty/two/colours.rb', line 33 def self.method_missing m, *args self[m] end |
.to_h ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/nineteen/eighty/two/colours.rb', line 23 def self.to_h h = {} self.constants[1..-1].sort.each do |c| h[c] = self[c] h[c.downcase] = self[c.downcase] end h end |