Module: Karafka::Helpers::Colorize

Included in:
Cli::Base, Cli::Install, Cli::Topics, Cli::Topics::Base
Defined in:
lib/karafka/helpers/colorize.rb

Overview

Simple wrapper for adding colors to strings

Instance Method Summary collapse

Instance Method Details

#green(string) ⇒ String

Returns green string.

Parameters:

  • string (String)

    string we want to have in green

Returns:

  • (String)

    green string



9
10
11
# File 'lib/karafka/helpers/colorize.rb', line 9

def green(string)
  "\033[0;32m#{string}\033[0m"
end

#grey(string) ⇒ String

Returns grey string.

Parameters:

  • string (String)

    string we want to have in grey

Returns:

  • (String)

    grey string



27
28
29
# File 'lib/karafka/helpers/colorize.rb', line 27

def grey(string)
  "\e[38;5;244m#{string}\e[0m"
end

#red(string) ⇒ String

Returns red string.

Parameters:

  • string (String)

    string we want to have in red

Returns:

  • (String)

    red string



15
16
17
# File 'lib/karafka/helpers/colorize.rb', line 15

def red(string)
  "\033[0;31m#{string}\033[0m"
end

#yellow(string) ⇒ String

Returns yellow string.

Parameters:

  • string (String)

    string we want to have in yellow

Returns:

  • (String)

    yellow string



21
22
23
# File 'lib/karafka/helpers/colorize.rb', line 21

def yellow(string)
  "\033[1;33m#{string}\033[0m"
end