Module which makes it very easy to use ANSI codes. These are esspecially nice for beautifying shell output.
Synopsis
require 'mega/ansicolor'
include ANSIColor
p red, "Hello", blue, "World"
=> "\e[31mHello\e[34mWorld"
p red { "Hello" } + blue { "World" }
=> "\e[31mHello\e[0m\e[34mWorld\e[0m"
Supported ANSI Commands
clear
reset # synonym for :clear
bold
dark
italic # not widely implemented
underline
underscore # synonym for :underline
blink
rapid_blink # not widely implemented
negative # no reverse because of String#reverse
concealed
strikethrough # not widely implemented
black
red
green
yellow
blue
magenta
cyan
white
on_black
on_red
on_green
on_yellow
on_blue
on_magenta
on_cyan
on_white
Author(s)
- Florian Frank <floriping.de>
Methods
Constants
| ColoredRegexp | = | /\e\[([34][0-7]|[0-9])m/ |
Public Instance methods
attributes()
[ source ]
uncolored(string = nil) {|.gsub(ColoredRegexp, '')| ...}
[ source ]