Module: Optics::ANSI

Included in:
Optics
Defined in:
lib/ansi.rb

Constant Summary collapse

COLORS =
{ 
  :black => 0,
  :red => 1,
  :green => 2,
  :yellow => 3,
  :blue => 4,
  :magenta => 5,
  :cyan => 6,
  :white => 7,
  :default => 9
}
EFFECTS =
{
  :reset => {
    :code => 0,
    :alias => [:clear]
    },
  :bright => {
    :code => 1,
    :alias => [:bold]
    },
  :italic => {
    :code => 3,
    :alias => [:italicize, :italics]
    },
  :underline => {
    :code => 4
    },
  :blink => {
    :code => 5
    },
  :inverse => {
    :code => 7,
    :alias => [:invert]
    },
  :conceal => {
    :code => 8,
    :alias => [:hide]
    },
  :normal => {
    :code => 22,
    :alias => [:normalize, :unbold]
    },
  :no_underline => {
    :code => 24
    },
  :blink_off => {
    :code => 25,
    :alias => [:no_blink]
    },
  :reveal => {
    :code => 28,
    :alias => [:unhide]
    }
}
CLASSES =
{
  :dark => 30,
  :light => 90,
  :dark_bg => 40,
  :light_bg => 100
}
C_STRUCTURE =
{
:dark => {
  :text => 30,
  :bg => 40
  },
:light => {
  :text => 90,
  :bg => 100
  }
}

Instance Method Summary collapse

Instance Method Details

#dark(color) ⇒ Object Also known as: dark_color, color

Dark-colored text



80
81
82
# File 'lib/ansi.rb', line 80

def dark(color)
 base(color, 3)
end

#dark_bg(color) ⇒ Object

Dark-colored background



94
95
96
# File 'lib/ansi.rb', line 94

def dark_bg(color)
  base(color,4)
end

#light(color) ⇒ Object Also known as: light_color, pale

Light-colored text



87
88
89
# File 'lib/ansi.rb', line 87

def light(color)
 base(color, 9)
end

#light_bg(color) ⇒ Object

Light-colored background



99
100
101
# File 'lib/ansi.rb', line 99

def light_bg(color)
  base(color,10)
end