Module: Sai::Decorator::NamedColors Abstract Private

Included in:
Sai::Decorator
Defined in:
lib/sai/decorator/named_colors.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.

This module is abstract.

This module is meant to be included in the Sai::Decorator class to provide named color methods

Note:

For each named color, two methods are dynamically generated:

  • color_name - Applies the color to the foreground
  • on_color_name - Applies the color to the backgroundAll color methods return Sai::Decorator

Named color methods for the Sai::Decorator class

Examples:

Using a named color

decorator.blue.decorate('Hello').to_s      #=> "\e[38;2;0;0;238mHello\e[0m"
decorator.on_blue.decorate('Hello').to_s   #=> "\e[48;2;0;0;238mHello\e[0m"

Author:

Since:

  • 0.3.1

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Class Method Details

.included(base) ⇒ void

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.

This method returns an undefined value.

Inject ClassMethods into the including class

Parameters:

  • base (Class) —

    the class including this module

Author:

Since:

  • 0.4.0



32
33
34
# File 'lib/sai/decorator/named_colors.rb', line 32

def self.included(base)
  base.extend(ClassMethods)
end