class Nineteen::Eighty::Two::Colours

Constants

BLACK
CYAN
MAGENTA
PRIMARIES
WHITE
YELLOW

Public Class Methods

[](key) click to toggle source
# 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) click to toggle source
# File lib/nineteen/eighty/two/colours.rb, line 37
def self.brighten colour
  colour.gsub 'b', 'f'
end
method_missing(m, *args) click to toggle source
# File lib/nineteen/eighty/two/colours.rb, line 33
def self.method_missing m, *args
  self[m]
end
to_h() click to toggle source
# 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