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

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

Returns:

  • (String)


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

Returns:

  • (String)


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

Returns:

  • (String)


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

Returns:

  • (String)


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

Returns:

  • (String)


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

Returns:

  • (String)


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

Returns:

  • (String)


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

Returns:

  • (String)


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

Returns:

  • (String)


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

Returns:

  • (String)


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

Returns:

  • (String)


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

Returns:

  • (String)


62
63
64
# File 'lib/cliqr/command/color.rb', line 62

def cyan(str)
  colorize(str, 36)
end

#disable_colorCliqr::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

Returns:

  • (String)


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

Returns:

  • (String)


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

Returns:

  • (String)


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

Returns:

  • (String)


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

Returns:

  • (String)


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

Returns:

  • (String)


41
42
43
# File 'lib/cliqr/command/color.rb', line 41

def yellow(str)
  colorize(str, 33)
end