Module: Term

Defined in:
lib/rcl/ext/ansicolour.rb

Overview

Name

Term::ANSIColour v0.01 (unstable)

Synopsis

require 'term/ansicolour'

print "Some ordinary text\n"
Term::ANSIColour.colour = ('red')
print "some red text..\n"
print "some more red text..\n"
Term::ANSIColour.colour = ('green')
print "some green text..\n"
Term::ANSIColour.colour = ('default')
puts "some ordinary text.."
puts "some magenta text".colour("magenta")
puts "some funky text".colour("cyan", "bold", "on_white", "blink")
puts "more ordinary text"

Description

prints out text in funny colours

Class Methods

--- Term::ANSIColour.colour
    Gets and sets the default output text colour (none by default)

Overridden Methods

--- print
    output text in the colour specified by Term::ANSIColour.colour
--- String.colour( colour )
    returns a string of the colour given in the argument (overriding Term::ANSIColour.colour).

To Do

--- Get puts, printf, putc and write to output coloured text.
--- Write some proper documentation.
--- Make the interface a bit cleaner.
--- Allow people to use string modifiers, constants, or overridden output
    methods depending on their taste.
--- Plug in a few enhancements such as regexp colouring, syntax highlighting
    and the like.
--- Alias @@colour to @color
--- Learn how to code ruby before I break something.

Credits

First version by Robert Ryan ([email protected]) borrowing extensively from
the perl version by Russ Allbery and Zenin. Additional input by Mark Hulme-Jones.

Copyright

Copyright 2002

This program is free software. You can redistribute it and/or modify it under the same terms as Ruby itself.

cut

Defined Under Namespace

Modules: ANSIColour