blob: 051c7c37e4354843076149bbd6b1097f624f9c0b [file] [log] [blame]
Term::ANSIColor version 3.01
(A simple ANSI text attribute control module)
Copyright 1996, 1997, 1998, 2000, 2001, 2002, 2005, 2006, 2007, 2009,
2010, 2011 Russ Allbery <rra@stanford.edu> and Zenin. This program is
free software; you may redistribute it and/or modify it under the same
terms as Perl itself.
I welcome bug reports and patches for this package at rra@stanford.edu.
However, please be aware that I tend to be extremely busy and to get a
lot of mail. I'll save your mail and get to it as soon as I can, but
depending on how busy I am it may take me a couple of months.
BLURB
Term::ANSIColor provides constants and simple functions for sending ANSI
text attributes, most notably colors. It can be used to set the current
text attributes or to apply a set of attributes to a string and reset
the current text attributes at the end of that string.
DESCRIPTION
This module grew out of a thread on comp.lang.perl.misc where several of
us were throwing around different ways to print colored text from Perl
scripts and Zenin posted his old library to do that. I (Russ) disagreed
with the implementation and offered my own (the color() and colored()
functions implemented in this package), Zenin convinced me that the
constants had their place as well, and we started figuring out the best
ways of implementing both.
While ANSI color escape codes are fairly simple, it can be hard to
remember the codes for all of the attributes and the code resulting from
hard-coding them into your script is definitely difficult to read. This
module is designed to fix those problems, as well as provide a
convenient interface to do a few things for you automatically (like
resetting attributes after the text you print out so that you don't
accidentally leave attributes set).
Despite its name, this module can also handle non-color ANSI text
attributes (bold, underline, reverse video, and blink). It uses either
of two interfaces, one of which uses "constants" for each different
attribute and the other of which uses two subs which take strings of
attributes as arguments.
See the POD documentation for complete details, features, and usage.
This module is distributed as part of the Perl core distribution as of
Perl 5.6.0. You only need to install this module if you want a newer
version than came with Perl or if you have an old version of Perl.
REQUIREMENTS
Term::ANSIColor is written in pure Perl and has no module dependencies
that aren't found in Perl core. It should work with any version of Perl
after 5.001, although it hasn't been tested with old versions in some
time.
The test suite requires the Test::More module. To check the POD
documentation, Test::Pod is also required. To check spelling,
Pod::Spell and either aspell or ispell with the american dictionary are
also required. The user's path is searched for aspell or ispell and
aspell is preferred. Spelling tests are disabled by default since
spelling dictionaries differ too much between systems. To enable those
tests, set RRA_MAINTAINER_TESTS to a true value.
INSTALLATION
WARNING: Installation of this package will replace the Term::ANSIColor
that came with Perl for Perl 5.6.0 or later. Term::ANSIColor that came
with Perl. You may want to save a backup copy of the standard version
first.
Follow the standard installation procedure for Perl modules, which is to
type the following commands:
perl Makefile.PL
make
make test
make install
You'll probably need to do the last as root. If instead you wish to
install the module by hand, simply copy it into a directory named Term
in your Perl library directory.
HOMEPAGE AND SOURCE REPOSITORY
The Term::ANSIColor web page at:
http://www.eyrie.org/~eagle/software/ansicolor/
will always have the current version of this package, the current
documentation, and pointers to any additional resources.
Term::ANSIColor is maintained using Git. You can access the current
source by cloning the repository at:
git://git.eyrie.org/perl/ansicolor.git
or view the repository on the web at:
http://git.eyrie.org/?p=perl/ansicolor.git
THANKS
To Jon Lennox for looking at early versions of this module, providing
feedback, and offering suggestions for improvement.
To Jesse Taylor for writing the first significant script to use this
module (colorized calsplit), thus offering innumerable opportunities to
test and debug.
To Jean Delvare for providing documentation of what the various
attributes do on various different terminal emulators, and for noting
that attribute 2 is dark.
To Edward Avis for the implementation of uncolor.
To Rani Pinchuk for the idea of ANSI_COLORS_DISABLED and an initial
implementation.
To ATricket for the information about what PuTTY, Windows telnet, and
OpenSSH under Cygwin support.
To Richard Maus for pointing out DARK was missing from the exported
constants list and CYAN and WHITE were missing from the documentation.
To Autrijus Tang for noticing a problem with string comparisons in the
test suite.
To Daniel Lindsley for the information about what Mac OS X Terminal
supports.
To Joe Smith for the test files that exercise a wide variety of VT100
escape sequences including the ECMA-48 color control codes.
To James Bowlin for catching a bug in colored when $EACHLINE is set that
caused it to not color lines consisting solely of 0.
To Helge Kreutzmann for pointing out the need for warnings in the
documentation about background colors that span newlines.
To Baron Schwartz for pointing out that cyan and white were missing from
the documentation.
To Michael R. Wolf for pointing out that Wikipedia and the ECMA standard
use faint instead of dark as the name of attribute 2.
To openmethods.com voice solutions for contributing PUSHCOLOR, POPCOLOR,
and LOCALCOLOR support.
To Tim Bellinghausen for the AUTOLOAD taint fix for Perl 5.10.
To Paul Miller for the idea and initial implementation of colorstrip.
To Jakob Ilves for sixteen-color support and the initial documentation
of bright color issues.
To Revilo Reegiles for reporting problems with the colored function and
non-array references with stringification defined, and providing a test
case.
To Larry Wall, as always, for Perl.