Term::ANSIColor version 4.02
(A simple ANSI text attribute control module)
This program is free software; you may redistribute it and/or modify it
under the same terms as Perl itself. Please see the section LICENSE
below for more information.
BLURB
Term::ANSIColor provides constants and simple functions for setting 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. Eight-color,
sixteen-color, and 256-color escape sequences are all supported.
DESCRIPTION
This Perl module is a simple and convenient interface to the ANSI
terminal escape sequences for color (from ECMA-48, also included in ISO
6429). The color sequences are provided in two forms, either as
constants for each color or via a function that takes the names of
colors and returns the appropriate escape codes or wraps them around the
provided text. The non-color text style codes from ANSI X3.64 (bold,
dark, underline, and reverse, for example), which were also included in
ECMA-48 and ISO 6429, are also supported. Also supported are the
extended colors used for sixteen-color and 256-color emulators.
This module is very stable, and I've used it in a wide variety of
applications. It has been included in the core Perl distribution
starting with version 5.6.0, so you don't need to download and install
it yourself unless you have an old version of Perl or need a newer
version of the module than comes with your version of Perl. I continue
to maintain it as a separate module, and the version included in Perl is
resynced with mine before each release.
The original module came out of a discussion in comp.lang.perl.misc and
is a combination of two approaches, one with constants by Zenin and one
with functions that I wrote. I offered to maintain a combined module
that included both approaches.
See the POD documentation for complete details, features, and usage.
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.6, although it hasn't been tested with old versions in some
time.
In order to actually see color, you will need to use a terminal window
that supports the ANSI escape sequences for color. Any recent version
of xterm, most xterm derivatives and replacements, and most telnet and
ssh clients for Windows and Macintosh should work, as will the MacOS X
Terminal application (although Terminal.app reportedly doesn't support
256 colors). The console windows for Windows NT and Windows 2000 will
not work, as they do not even attempt to support ANSI X3.64.
For a complete (to my current knowledge) compatibility list, see the
Term::ANSIColor module documentation. If you have any additions to the
table in the documentation, please send them to me.
The test suite requires Perl and Test::More (part of Perl since 5.6.2).
It also makes use of additional Perl modules for some tests. These
tests will be skipped automatically if the modules aren't available. To
run the full set of default tests, you will need the Perl modules:
Perl::Critic
Test::MinimumVersion
Test::Pod
Test::Pod::Coverage
Test::Strict
Test::Synopsis
Test::Warn
and their dependencies. These modules are all available from CPAN.
Some parts of the test suite are suppressed by default because those
tests are normally only useful for the maintainer. This includes tests
of POD spelling and Perl coding style. To enable those tests, set the
environment variable RRA_MAINTAINER_TESTS to a true value. For these
tests, the additional Perl modules:
Devel::Cover
Test::Perl::Critic
Test::Spelling
and their dependencies as well as a spell-checking program (several are
supported by Test::Spelling) are required. These modules are all
available from CPAN.
INSTALLATION
WARNING: Installation of this package will replace the 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.
SUPPORT
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.
For bug tracking, this package uses the CPAN bug tracker at:
https://rt.cpan.org/Public/Dist/Display.html?Name=Term-ANSIColor
I welcome bug reports and patches for this package at rra@stanford.edu
or via the CPAN bug tracker. However, please be aware that I tend to be
extremely busy and work projects often take priority. I'll save your
mail and get to it as soon as I can, but it may take me a couple of
months.
SOURCE REPOSITORY
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
When contributing modifications, patches (possibly generated by
git-format-patch) are preferred to Git pull requests.
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 original test files that exercise a wide variety of
VT100 escape sequences including the ECMA-48 color control codes. These
have been replaced by an example script, but they were very useful.
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 Kent Fredric for the request for italic and the report of a terminal
emulator that supports it.
To Simon Wistow for reporting that Term::ANSIColor was inadvertantly
clobbering $@ when generating constant subs.
To Kurt Starsinic for the initial implementation of 256-color support.
To Magnus Woldrich for Term::ExtendedColor and for research on which
emulators support 256 colors.
To Stephen Thirlwall for the initial implementation of custom color
support.
To BlueT - Matthew Lien - 練喆明 for quick testing of 4.00 and reporting
a problem with skipping one of the tests.
To David Cantrell for testing with Perl 5.6.2 and debugging why a test
case didn't work with its version of Exporter.
To Larry Wall, as always, for Perl.
LICENSE
The Term-ANSIColor distribution as a whole is covered by the following
copyright statement and license:
Copyright 1996 Zenin
Copyright 1996, 1997, 1998, 2000, 2001, 2002, 2005, 2006, 2008, 2009,
2010, 2011, 2012, 2013 Russ Allbery <rra@stanford.edu>
Copyright 2012 Kurt Starsinic <kstarsinic@gmail.com>
This program is free software; you may redistribute it and/or modify
it under the same terms as Perl itself. This means that you may
choose between the two licenses that Perl is released under: the GNU
GPL and the Artistic License. Please see your Perl distribution for
the details and copies of the licenses.
PUSH/POP support submitted 2007 by openmethods.com voice solutions
All individual files without an explicit exception below are released
under this license. Some files may have additional copyright holders as
noted in those files. There is detailed information about the licensing
of each file in the LICENSE file in this distribution.
Some files in this distribution are individually released under
different licenses, all of which are compatible with the above general
package license but which may require preservation of additional
notices. All required notices are preserved in the LICENSE file.