Class: Palette::Color

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

Constant Summary collapse

BASE_SET =
[0, 95, 135, 175, 215, 255]
GRAY_SET =
[  8,  18,  28,  38,  48,  58,  68,  78,  88,  98, 108, 118,
128, 138, 148, 158, 168, 178, 188, 198, 208, 218, 228, 238]

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Color

Returns a new instance of Color.



7
8
9
# File 'lib/palette/color.rb', line 7

def initialize(value)
  @hex = self.class.parse(value)
end

Instance Method Details

#to_ctermObject



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

def to_cterm
  return "NONE" if @hex == "NONE"
  cterm_of_closest_cterm_hex
end

#to_hexObject



11
12
13
# File 'lib/palette/color.rb', line 11

def to_hex
  @hex
end