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
- #black ⇒ Object
- #blue ⇒ Object
- #brown ⇒ Object
- #dark_blue ⇒ Object
- #dark_gray ⇒ Object
- #dark_green ⇒ Object
- #dark_purple ⇒ Object
- #green ⇒ Object
- #indigo ⇒ Object
- #light_gray ⇒ Object
- #orange ⇒ Object
- #peach ⇒ Object
- #pink ⇒ Object
- #red ⇒ Object
- #rgb(color) ⇒ Object
- #white ⇒ Object
- #xml_color(color) ⇒ Object
- #yellow ⇒ Object
Instance Method Details
#black ⇒ Object
27 |
# File 'lib/author_engine/game/common/parts/colors.rb', line 27 def black; rgb(COLORS.dig(0)); end |
#blue ⇒ Object
42 |
# File 'lib/author_engine/game/common/parts/colors.rb', line 42 def blue; rgb(COLORS.dig(12)); end |
#brown ⇒ Object
32 |
# File 'lib/author_engine/game/common/parts/colors.rb', line 32 def brown; rgb(COLORS.dig(4)); end |
#dark_blue ⇒ Object
28 |
# File 'lib/author_engine/game/common/parts/colors.rb', line 28 def dark_blue; rgb(COLORS.dig(1)); end |
#dark_gray ⇒ Object
33 |
# File 'lib/author_engine/game/common/parts/colors.rb', line 33 def dark_gray; rgb(COLORS.dig(5)); end |
#dark_green ⇒ Object
30 |
# File 'lib/author_engine/game/common/parts/colors.rb', line 30 def dark_green; rgb(COLORS.dig(3)); end |
#dark_purple ⇒ Object
29 |
# File 'lib/author_engine/game/common/parts/colors.rb', line 29 def dark_purple; rgb(COLORS.dig(2)); end |
#green ⇒ Object
40 |
# File 'lib/author_engine/game/common/parts/colors.rb', line 40 def green; rgb(COLORS.dig(11)); end |
#indigo ⇒ Object
43 |
# File 'lib/author_engine/game/common/parts/colors.rb', line 43 def indigo; rgb(COLORS.dig(13)); end |
#light_gray ⇒ Object
34 |
# File 'lib/author_engine/game/common/parts/colors.rb', line 34 def light_gray; rgb(COLORS.dig(6)); end |
#orange ⇒ Object
38 |
# File 'lib/author_engine/game/common/parts/colors.rb', line 38 def orange; rgb(COLORS.dig(9)); end |
#peach ⇒ Object
45 |
# File 'lib/author_engine/game/common/parts/colors.rb', line 45 def peach; rgb(COLORS.dig(15)); end |
#pink ⇒ Object
44 |
# File 'lib/author_engine/game/common/parts/colors.rb', line 44 def pink; rgb(COLORS.dig(14)); end |
#red ⇒ Object
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 |
#white ⇒ Object
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 |
#yellow ⇒ Object
39 |
# File 'lib/author_engine/game/common/parts/colors.rb', line 39 def yellow; rgb(COLORS.dig(10)); end |