Module: Sevgi::Function::Color

Included in:
Sevgi::Function
Defined in:
lib/sevgi/function/color.rb

Overview

ANSI color and style methods promoted to Sevgi::F. This module organizes the facade implementation; it is not a consumer mixin contract.

Instance Method Summary collapse

Instance Method Details

#blue(string) ⇒ String

Wraps a string in the blue terminal style.

Parameters:

  • string (Object)

    content to style

Returns:



11
# File 'lib/sevgi/function/color.rb', line 11

def blue(string) = "\e[1m\e[38;5;81m#{string}\e[0m"

#bold(string) ⇒ String

Wraps a string in the bold terminal style.

Parameters:

  • string (Object)

    content to style

Returns:



41
# File 'lib/sevgi/function/color.rb', line 41

def bold(string) = "\e[1m#{string}\e[0m"

#cyan(string) ⇒ String

Wraps a string in the cyan terminal style.

Parameters:

  • string (Object)

    content to style

Returns:



16
# File 'lib/sevgi/function/color.rb', line 16

def cyan(string) = "\e[1m\e[38;5;51m#{string}\e[0m"

#dim(string) ⇒ String

Wraps a string in the dim terminal style.

Parameters:

  • string (Object)

    content to style

Returns:



46
# File 'lib/sevgi/function/color.rb', line 46

def dim(string) = "\e[1m\e[2m#{string}\e[0m"

#green(string) ⇒ String

Wraps a string in the green terminal style.

Parameters:

  • string (Object)

    content to style

Returns:



21
# File 'lib/sevgi/function/color.rb', line 21

def green(string) = "\e[1m\e[38;5;35m#{string}\e[0m"

#magenta(string) ⇒ String

Wraps a string in the magenta terminal style.

Parameters:

  • string (Object)

    content to style

Returns:



26
# File 'lib/sevgi/function/color.rb', line 26

def magenta(string) = "\e[1m\e[38;5;200m#{string}\e[0m"

#red(string) ⇒ String

Wraps a string in the red terminal style.

Parameters:

  • string (Object)

    content to style

Returns:



31
# File 'lib/sevgi/function/color.rb', line 31

def red(string) = "\e[1m\e[38;5;197m#{string}\e[0m"

#yellow(string) ⇒ String

Wraps a string in the yellow terminal style.

Parameters:

  • string (Object)

    content to style

Returns:



36
# File 'lib/sevgi/function/color.rb', line 36

def yellow(string) = "\e[1m\e[38;5;227m#{string}\e[0m"