Class: Palette::Color
- Inherits:
-
Object
- Object
- Palette::Color
- 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
-
#initialize(value) ⇒ Color
constructor
A new instance of Color.
- #to_cterm ⇒ Object
- #to_hex ⇒ Object
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_cterm ⇒ Object
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_hex ⇒ Object
11 12 13 |
# File 'lib/palette/color.rb', line 11 def to_hex @hex end |