Parent

Methods

Thor::Shell::Color

Inherit from Thor::Shell::Basic and add set_color behavior. Check Thor::Shell::Basic to see all available methods.

Constants

CLEAR

Embed in a String to clear all previous ANSI sequences.

BOLD

The start of an ANSI bold sequence.

BLACK

Set the terminal’s foreground ANSI color to black.

RED

Set the terminal’s foreground ANSI color to red.

GREEN

Set the terminal’s foreground ANSI color to green.

YELLOW

Set the terminal’s foreground ANSI color to yellow.

BLUE

Set the terminal’s foreground ANSI color to blue.

MAGENTA

Set the terminal’s foreground ANSI color to magenta.

CYAN

Set the terminal’s foreground ANSI color to cyan.

WHITE

Set the terminal’s foreground ANSI color to white.

ON_BLACK

Set the terminal’s background ANSI color to black.

ON_RED

Set the terminal’s background ANSI color to red.

ON_GREEN

Set the terminal’s background ANSI color to green.

ON_YELLOW

Set the terminal’s background ANSI color to yellow.

ON_BLUE

Set the terminal’s background ANSI color to blue.

ON_MAGENTA

Set the terminal’s background ANSI color to magenta.

ON_CYAN

Set the terminal’s background ANSI color to cyan.

ON_WHITE

Set the terminal’s background ANSI color to white.

Public Instance Methods

set_color(string, color, bold=false) click to toggle source

Set color by using a string or one of the defined constants. If a third option is set to true, it also adds bold to the string. This is based on Highline implementation and it automatically appends CLEAR to the end of the returned String.

    # File lib/thor/shell/color.rb, line 53
53:       def set_color(string, color, bold=false)
54:         color = self.class.const_get(color.to_s.upcase) if color.is_a?(Symbol)
55:         bold  = bold ? BOLD : ""
56:         "#{bold}#{color}#{string}#{CLEAR}"
57:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.