Class: Ronin::UI::Output::Terminal::Color

Inherits:
Object
  • Object
show all
Defined in:
lib/ronin/ui/output/terminal/color.rb

Overview

The handler for color output to the terminal.

Constant Summary collapse

GREEN =

ANSI Green code

"\e[32m"
CYAN =

ANSI Cyan code

"\e[36m"
YELLOW =

ANSI Yellow code

"\e[33m"
RED =

ANSI Red code

"\e[31m"
BRIGHT =

ANSI Bright code

"\e[1m"
BRIGHT_OFF =

ANSI Bright-Off code

"\e[21m"
CLEAR =

ANSI Clear code

"\e[0m"

Class Method Summary collapse

Class Method Details

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.

Prints a debug message.

Since:

  • 1.0.0


88
89
90
# File 'lib/ronin/ui/output/terminal/color.rb', line 88

def self.print_debug(message)
  $stdout.puts "#{CYAN}#{BRIGHT}[=]#{BRIGHT_OFF} #{message}#{CLEAR}"
end

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.

Prints an error message.

Since:

  • 1.0.0


116
117
118
# File 'lib/ronin/ui/output/terminal/color.rb', line 116

def self.print_error(message)
  $stdout.puts "#{RED}#{BRIGHT}[!]#{BRIGHT_OFF} #{message}#{CLEAR}"
end

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.

Prints an info message.

Since:

  • 1.0.0


74
75
76
# File 'lib/ronin/ui/output/terminal/color.rb', line 74

def self.print_info(message)
  $stdout.puts "#{GREEN}#{BRIGHT}[-]#{BRIGHT_OFF} #{message}#{CLEAR}"
end

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.

Prints a warning message.

Since:

  • 1.0.0


102
103
104
# File 'lib/ronin/ui/output/terminal/color.rb', line 102

def self.print_warning(message)
  $stdout.puts "#{YELLOW}#{BRIGHT}[*]#{BRIGHT_OFF} #{message}#{CLEAR}"
end

.write(data) ⇒ Object

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.

Writes data to STDOUT.

Since:

  • 1.0.0


60
61
62
# File 'lib/ronin/ui/output/terminal/color.rb', line 60

def self.write(data)
  $stdout.write(data)
end