Module: Cliqr::Command::Color Private
- Included in:
- CommandContext, ShellPromptBuilder, Usage::CommandUsageContext
- Defined in:
- lib/cliqr/command/color.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Colors that can be used in a command to colorize strings
Instance Method Summary collapse
-
#bg_black(str) ⇒ String
private
Colorize a the background in black.
-
#bg_blue(str) ⇒ String
private
Colorize a the background in blue.
-
#bg_cyan(str) ⇒ String
private
Colorize a the background in cyan.
-
#bg_gray(str) ⇒ String
private
Colorize a the background in gray.
-
#bg_green(str) ⇒ String
private
Colorize a the background in green.
-
#bg_magenta(str) ⇒ String
private
Colorize a the background in magenta.
-
#bg_red(str) ⇒ String
private
Colorize a the background in red.
-
#bg_yellow(str) ⇒ String
private
Colorize a the background in yellow.
-
#black(str) ⇒ String
private
Colorize a string with black color.
-
#blue(str) ⇒ String
private
Colorize a string with blue color.
-
#bold(str) ⇒ String
private
Returns the bold representation.
-
#cyan(str) ⇒ String
private
Colorize a string with cyan color.
-
#disable_color ⇒ Cliqr::Command::Color
private
Disable colors.
-
#gray(str) ⇒ String
private
Colorize a string with gray color.
-
#green(str) ⇒ String
private
Colorize a string with green color.
-
#initialize(config = nil) ⇒ Cliqr::Command::Color
private
Create a new color instance.
-
#magenta(str) ⇒ String
private
Colorize a string with magenta color.
-
#red(str) ⇒ String
private
Colorize a string with red color.
-
#reverse_color(str) ⇒ String
private
Reverses the color of a string and its background.
-
#yellow(str) ⇒ String
private
Colorize a string with yellow color.
Instance Method Details
#bg_black(str) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Colorize a the background in black
76 77 78 |
# File 'lib/cliqr/command/color.rb', line 76 def bg_black(str) colorize(str, 40) end |
#bg_blue(str) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Colorize a the background in blue
104 105 106 |
# File 'lib/cliqr/command/color.rb', line 104 def bg_blue(str) colorize(str, 44) end |
#bg_cyan(str) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Colorize a the background in cyan
118 119 120 |
# File 'lib/cliqr/command/color.rb', line 118 def bg_cyan(str) colorize(str, 46) end |
#bg_gray(str) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Colorize a the background in gray
125 126 127 |
# File 'lib/cliqr/command/color.rb', line 125 def bg_gray(str) colorize(str, 47) end |
#bg_green(str) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Colorize a the background in green
90 91 92 |
# File 'lib/cliqr/command/color.rb', line 90 def bg_green(str) colorize(str, 42) end |
#bg_magenta(str) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Colorize a the background in magenta
111 112 113 |
# File 'lib/cliqr/command/color.rb', line 111 def bg_magenta(str) colorize(str, 45) end |
#bg_red(str) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Colorize a the background in red
83 84 85 |
# File 'lib/cliqr/command/color.rb', line 83 def bg_red(str) colorize(str, 41) end |
#bg_yellow(str) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Colorize a the background in yellow
97 98 99 |
# File 'lib/cliqr/command/color.rb', line 97 def bg_yellow(str) colorize(str, 43) end |
#black(str) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Colorize a string with black color
20 21 22 |
# File 'lib/cliqr/command/color.rb', line 20 def black(str) colorize(str, 30) end |
#blue(str) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Colorize a string with blue color
48 49 50 |
# File 'lib/cliqr/command/color.rb', line 48 def blue(str) colorize(str, 34) end |
#bold(str) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the bold representation
132 133 134 |
# File 'lib/cliqr/command/color.rb', line 132 def bold(str) colorize(str, 1, 22) end |
#cyan(str) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Colorize a string with cyan color
62 63 64 |
# File 'lib/cliqr/command/color.rb', line 62 def cyan(str) colorize(str, 36) end |
#disable_color ⇒ Cliqr::Command::Color
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Disable colors
146 147 148 149 150 151 152 |
# File 'lib/cliqr/command/color.rb', line 146 def disable_color instance_eval do def colorize(str, *_args) str end end end |
#gray(str) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Colorize a string with gray color
69 70 71 |
# File 'lib/cliqr/command/color.rb', line 69 def gray(str) colorize(str, 37) end |
#green(str) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Colorize a string with green color
34 35 36 |
# File 'lib/cliqr/command/color.rb', line 34 def green(str) colorize(str, 32) end |
#initialize(config = nil) ⇒ Cliqr::Command::Color
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Create a new color instance
12 13 14 15 |
# File 'lib/cliqr/command/color.rb', line 12 def initialize(config = nil) # check and disable colors if needed check_color_setting(config) unless config.nil? end |
#magenta(str) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Colorize a string with magenta color
55 56 57 |
# File 'lib/cliqr/command/color.rb', line 55 def magenta(str) colorize(str, 35) end |
#red(str) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Colorize a string with red color
27 28 29 |
# File 'lib/cliqr/command/color.rb', line 27 def red(str) colorize(str, 31) end |
#reverse_color(str) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Reverses the color of a string and its background
139 140 141 |
# File 'lib/cliqr/command/color.rb', line 139 def reverse_color(str) colorize(str, 7, 27) end |
#yellow(str) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Colorize a string with yellow color
41 42 43 |
# File 'lib/cliqr/command/color.rb', line 41 def yellow(str) colorize(str, 33) end |