RAA - ansicolor/0.0.3

ansicolor / 0.0.3

Short description: ansicolor
Category: Library/Term
Status: usable
Created: 2002-07-27 01:49:05 GMT
Last update: 2003-10-19 08:52:11 GMT
Owner: Florian Frank (Projects of this owner)
Homepage: http://www.ping.de/~flori/ruby/programs/term-ansicolor.html
Download: http://www.ping.de/~flori/ruby/programs/ruby/term-ansicolor-0.0.3.tgz
License: GPL
Dependency:
Required by: acoc/0.5.2
Description:

Small Ruby library that colors strings using ANSI escape sequences. It's possible to use constants:

include Term::ANSIColor
print red, bold, "red bold", reset, "\n"

Or unary functions:

include Term::ANSIColor
print red(bold("red bold")), "\n"

Blockforms do also autoreset at the block's end:

include Term::ANSIColor
print red { bold { "red bold" } }, "\n"

It's also possible to use this module as Mixin for classes of objects that respond to :to_str, e. g. String.

class String
include Term::ANSIColor
end
print "red bold".red.bold, "\n"

I added the "uncolored" method as suggested by
Thomas Husterer in this release, if you want to
to get rid of ANSI color sequences in
a string.

Versions: [1.0.3 (2007-10-05)] [1.0.2 (2005-11-12)] [1.0.1 (2005-09-05)] [1.0.0 (2005-04-15)] [0.0.4 (2004-10-02)] [0.0.3 (2003-10-19)]

Edit this project (for project owner)

back to RAA top