Class: Badline::GUI::Palette

Inherits:
Object
  • Object
show all
Defined in:
lib/badline/gui/palette.rb

Constant Summary collapse

COLORS =
[
  "#000000", "#FFFFFF", "#924A40", "#84C5CC",
  "#9351B6", "#72B14B", "#483AAA", "#D5DF7C",
  "#675200", "#C33D00", "#C18178", "#606060",
  "#8A8A8A", "#B3EC91", "#867ADE", "#B3B3B3"
].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePalette

Returns a new instance of Palette.



15
16
17
18
# File 'lib/badline/gui/palette.rb', line 15

def initialize
  @dwords = COLORS.map { |hex| dword(hex) }.freeze
  @entries = @dwords.map { |rgba| [rgba].pack("V") }.freeze
end

Instance Attribute Details

#dwordsObject (readonly)

Returns the value of attribute dwords.



13
14
15
# File 'lib/badline/gui/palette.rb', line 13

def dwords
  @dwords
end

Instance Method Details

#[](color) ⇒ Object



20
21
22
# File 'lib/badline/gui/palette.rb', line 20

def [](color)
  @entries[color]
end