Module: AuthorEngine::Part::Colors

Included in:
CodeEditor::Cursor, CodeEditor::Highlighting, Container, Game, AuthorEngine::Palette, View
Defined in:
lib/author_engine/game/common/parts/colors.rb

Defined Under Namespace

Classes: Color

Constant Summary collapse

COLORS =
{
  0 => Color.new(0,0,0),
  1 => Color.new(29, 43, 83),
  2 => Color.new(126, 37, 83),
  3 => Color.new(0, 135, 81),

  4 => Color.new(171, 82, 54),
  5 => Color.new(95, 87, 79),
  6 => Color.new(194, 195, 199),
  7 => Color.new(255, 241, 232),

  8  => Color.new(255, 0, 77),
  9  => Color.new(255, 163, 0),
  10 => Color.new(225, 236, 39),
  11 => Color.new(0, 228, 54),

  12 => Color.new(41, 173, 255),
  13 => Color.new(131, 118, 156),
  14 => Color.new(225, 119, 168),
  15 => Color.new(255, 204, 170)
}

Instance Method Summary collapse

Instance Method Details

#blackObject



27
# File 'lib/author_engine/game/common/parts/colors.rb', line 27

def black;       rgb(COLORS.dig(0)); end

#blueObject



42
# File 'lib/author_engine/game/common/parts/colors.rb', line 42

def blue;        rgb(COLORS.dig(12)); end

#brownObject



32
# File 'lib/author_engine/game/common/parts/colors.rb', line 32

def brown;       rgb(COLORS.dig(4)); end

#dark_blueObject



28
# File 'lib/author_engine/game/common/parts/colors.rb', line 28

def dark_blue;   rgb(COLORS.dig(1)); end

#dark_grayObject



33
# File 'lib/author_engine/game/common/parts/colors.rb', line 33

def dark_gray;   rgb(COLORS.dig(5)); end

#dark_greenObject



30
# File 'lib/author_engine/game/common/parts/colors.rb', line 30

def dark_green;  rgb(COLORS.dig(3)); end

#dark_purpleObject



29
# File 'lib/author_engine/game/common/parts/colors.rb', line 29

def dark_purple; rgb(COLORS.dig(2)); end

#greenObject



40
# File 'lib/author_engine/game/common/parts/colors.rb', line 40

def green;       rgb(COLORS.dig(11)); end

#indigoObject



43
# File 'lib/author_engine/game/common/parts/colors.rb', line 43

def indigo;      rgb(COLORS.dig(13)); end

#light_grayObject



34
# File 'lib/author_engine/game/common/parts/colors.rb', line 34

def light_gray;  rgb(COLORS.dig(6)); end

#orangeObject



38
# File 'lib/author_engine/game/common/parts/colors.rb', line 38

def orange;      rgb(COLORS.dig(9)); end

#peachObject



45
# File 'lib/author_engine/game/common/parts/colors.rb', line 45

def peach;       rgb(COLORS.dig(15)); end

#pinkObject



44
# File 'lib/author_engine/game/common/parts/colors.rb', line 44

def pink;        rgb(COLORS.dig(14)); end

#redObject



37
# File 'lib/author_engine/game/common/parts/colors.rb', line 37

def red;         rgb(COLORS.dig(8)); end

#rgb(color) ⇒ Object



47
48
49
50
51
52
53
# File 'lib/author_engine/game/common/parts/colors.rb', line 47

def rgb(color)
  if RUBY_ENGINE == "opal"
    return "rgb(#{color.red}, #{color.green}, #{color.blue})"
  else
    return Gosu::Color.rgb(color.red, color.green, color.blue)
  end
end

#whiteObject



35
# File 'lib/author_engine/game/common/parts/colors.rb', line 35

def white;       rgb(COLORS.dig(7)); end

#xml_color(color) ⇒ Object



55
56
57
58
59
60
61
62
63
64
65
# File 'lib/author_engine/game/common/parts/colors.rb', line 55

def xml_color(color)
  red   = color.red.to_s(16)
  green = color.green.to_s(16)
  blue  = color.blue.to_s(16)

  red   = "0#{red}"   if color.red < 10
  green = "0#{green}" if color.green < 10
  blue  = "0#{blue}"  if color.blue < 10

  return "#{red}#{green}#{blue}"
end

#yellowObject



39
# File 'lib/author_engine/game/common/parts/colors.rb', line 39

def yellow;      rgb(COLORS.dig(10)); end