Class: Dex::UI::Color
- Inherits:
-
Object
- Object
- Dex::UI::Color
- Defined in:
- lib/dex/ui/color.rb
Defined Under Namespace
Classes: InvalidColorName
Constant Summary collapse
- RED =
new('31', :red)
- GREEN =
new('32', :green)
- YELLOW =
new('33', :yellow)
- BLUE =
new('34', :blue)
- MAGENTA =
new('35', :magenta)
- CYAN =
new('36', :cyan)
- WHITE =
new('97', :white)
- RESET =
new('0', :reset)
- BOLD =
new('1', :bold)
- MAP =
{ red: RED, green: GREEN, yellow: YELLOW, blue: BLUE, magenta: MAGENTA, cyan: CYAN, reset: RESET, bold: BOLD, }.freeze
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#sgr ⇒ Object
readonly
Returns the value of attribute sgr.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(sgr, name) ⇒ Color
constructor
A new instance of Color.
Constructor Details
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
6 7 8 |
# File 'lib/dex/ui/color.rb', line 6 def code @code end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/dex/ui/color.rb', line 6 def name @name end |
#sgr ⇒ Object (readonly)
Returns the value of attribute sgr.
6 7 8 |
# File 'lib/dex/ui/color.rb', line 6 def sgr @sgr end |
Class Method Details
.available ⇒ Object
52 53 54 |
# File 'lib/dex/ui/color.rb', line 52 def self.available MAP.keys end |
.lookup(name) ⇒ Object
46 47 48 49 50 |
# File 'lib/dex/ui/color.rb', line 46 def self.lookup(name) MAP.fetch(name) rescue KeyError raise InvalidColorName, name end |