|
Packit |
e6c7a3 |
# Term::ANSIColor 4.06
|
|
Packit |
e6c7a3 |
|
|
Packit |
e6c7a3 |
Copyright 1996-1998, 2000-2002, 2005-2006, 2008-2016 Russ Allbery
|
|
Packit |
e6c7a3 |
<rra@cpan.org>. Copyright 1996 Zenin. Copyright 2012 Kurt Starsinic
|
|
Packit |
e6c7a3 |
<kstarsinic@gmail.com>. This software is distributed under the same terms
|
|
Packit |
e6c7a3 |
as Perl itself. Please see the section [License](#license) below for more
|
|
Packit |
e6c7a3 |
information.
|
|
Packit |
e6c7a3 |
|
|
Packit |
e6c7a3 |
## Blurb
|
|
Packit |
e6c7a3 |
|
|
Packit |
e6c7a3 |
Term::ANSIColor provides constants and simple functions for setting ANSI
|
|
Packit |
e6c7a3 |
text attributes, most notably colors. It can be used to set the current
|
|
Packit |
e6c7a3 |
text attributes or to apply a set of attributes to a string and reset the
|
|
Packit |
e6c7a3 |
current text attributes at the end of that string. Eight-color,
|
|
Packit |
e6c7a3 |
sixteen-color, and 256-color escape sequences are all supported.
|
|
Packit |
e6c7a3 |
|
|
Packit |
e6c7a3 |
## Description
|
|
Packit |
e6c7a3 |
|
|
Packit |
e6c7a3 |
This Perl module is a simple and convenient interface to the ANSI terminal
|
|
Packit |
e6c7a3 |
escape sequences for color (from ECMA-48, also included in ISO 6429). The
|
|
Packit |
e6c7a3 |
color sequences are provided in two forms, either as constants for each
|
|
Packit |
e6c7a3 |
color or via a function that takes the names of colors and returns the
|
|
Packit |
e6c7a3 |
appropriate escape codes or wraps them around the provided text. The
|
|
Packit |
e6c7a3 |
non-color text style codes from ANSI X3.64 (bold, dark, underline, and
|
|
Packit |
e6c7a3 |
reverse, for example), which were also included in ECMA-48 and ISO 6429,
|
|
Packit |
e6c7a3 |
are also supported. Also supported are the extended colors used for
|
|
Packit |
e6c7a3 |
sixteen-color and 256-color emulators.
|
|
Packit |
e6c7a3 |
|
|
Packit |
e6c7a3 |
This module is very stable, and I've used it in a wide variety of
|
|
Packit |
e6c7a3 |
applications. It has been included in the core Perl distribution starting
|
|
Packit |
e6c7a3 |
with version 5.6.0, so you don't need to download and install it yourself
|
|
Packit |
e6c7a3 |
unless you have an old version of Perl or need a newer version of the
|
|
Packit |
e6c7a3 |
module than comes with your version of Perl. I continue to maintain it as
|
|
Packit |
e6c7a3 |
a separate module, and the version included in Perl is resynced with mine
|
|
Packit |
e6c7a3 |
before each release.
|
|
Packit |
e6c7a3 |
|
|
Packit |
e6c7a3 |
The original module came out of a discussion in comp.lang.perl.misc and is
|
|
Packit |
e6c7a3 |
a combination of two approaches, one with constants by Zenin and one with
|
|
Packit |
e6c7a3 |
functions that I wrote. I offered to maintain a combined module that
|
|
Packit |
e6c7a3 |
included both approaches.
|
|
Packit |
e6c7a3 |
|
|
Packit |
e6c7a3 |
## Requirements
|
|
Packit |
e6c7a3 |
|
|
Packit |
e6c7a3 |
Term::ANSIColor is written in pure Perl and has no module dependencies
|
|
Packit |
e6c7a3 |
that aren't found in Perl core. It should work with any version of Perl
|
|
Packit |
e6c7a3 |
after 5.6, although it hasn't been tested with old versions in some time.
|
|
Packit |
e6c7a3 |
|
|
Packit |
e6c7a3 |
In order to actually see color, you will need to use a terminal window
|
|
Packit |
e6c7a3 |
that supports the ANSI escape sequences for color. Any recent version of
|
|
Packit |
e6c7a3 |
xterm, most xterm derivatives and replacements, and most telnet and ssh
|
|
Packit |
e6c7a3 |
clients for Windows and Macintosh should work, as will the MacOS X
|
|
Packit |
e6c7a3 |
Terminal application (although Terminal.app reportedly doesn't support 256
|
|
Packit |
e6c7a3 |
colors). The console windows for Windows NT and Windows 2000 will not
|
|
Packit |
e6c7a3 |
work, as they do not even attempt to support ANSI X3.64.
|
|
Packit |
e6c7a3 |
|
|
Packit |
e6c7a3 |
For a complete (to my current knowledge) compatibility list, see the
|
|
Packit |
e6c7a3 |
Term::ANSIColor module documentation. If you have any additions to the
|
|
Packit |
e6c7a3 |
table in the documentation, please send them to me.
|
|
Packit |
e6c7a3 |
|
|
Packit |
e6c7a3 |
The test suite requires Test::More (part of Perl since 5.6.2). The
|
|
Packit |
e6c7a3 |
following additional Perl modules will be used by the test suite if
|
|
Packit |
e6c7a3 |
present:
|
|
Packit |
e6c7a3 |
|
|
Packit |
e6c7a3 |
* Devel::Cover
|
|
Packit |
e6c7a3 |
* Test::MinimumVersion
|
|
Packit |
e6c7a3 |
* Test::Perl::Critic
|
|
Packit |
e6c7a3 |
* Test::Pod
|
|
Packit |
e6c7a3 |
* Test::Pod::Coverage
|
|
Packit |
e6c7a3 |
* Test::Spelling
|
|
Packit |
e6c7a3 |
* Test::Strict
|
|
Packit |
e6c7a3 |
* Test::Synopsis
|
|
Packit |
e6c7a3 |
* Test::Warn
|
|
Packit |
e6c7a3 |
|
|
Packit |
e6c7a3 |
All are available on CPAN. Those tests will be skipped if the modules are
|
|
Packit |
e6c7a3 |
not available.
|
|
Packit |
e6c7a3 |
|
|
Packit |
e6c7a3 |
To enable tests that don't detect functionality problems but are used to
|
|
Packit |
e6c7a3 |
sanity-check the release, set the environment variable `RELEASE_TESTING`
|
|
Packit |
e6c7a3 |
to a true value. To enable tests that may be sensitive to the local
|
|
Packit |
e6c7a3 |
environment or that produce a lot of false positives without uncovering
|
|
Packit |
e6c7a3 |
many problems, set the environment variable `AUTHOR_TESTING` to a true
|
|
Packit |
e6c7a3 |
value.
|
|
Packit |
e6c7a3 |
|
|
Packit |
e6c7a3 |
## Building and Installation
|
|
Packit |
e6c7a3 |
|
|
Packit |
e6c7a3 |
Term::ANSIColor uses ExtUtils::MakeMaker and can be installed using the
|
|
Packit |
e6c7a3 |
same process as any other ExtUtils::MakeMaker module:
|
|
Packit |
e6c7a3 |
|
|
Packit |
e6c7a3 |
```
|
|
Packit |
e6c7a3 |
perl Makefile.PL
|
|
Packit |
e6c7a3 |
make
|
|
Packit |
e6c7a3 |
make test
|
|
Packit |
e6c7a3 |
make install
|
|
Packit |
e6c7a3 |
```
|
|
Packit |
e6c7a3 |
|
|
Packit |
e6c7a3 |
You'll probably need to do the last as root unless you're installing into
|
|
Packit |
e6c7a3 |
a local Perl module tree in your home directory.
|
|
Packit |
e6c7a3 |
|
|
Packit |
e6c7a3 |
## Support
|
|
Packit |
e6c7a3 |
|
|
Packit |
e6c7a3 |
The [Term::ANSIColor web
|
|
Packit |
e6c7a3 |
page](https://www.eyrie.org/~eagle/software/ansicolor/) will always have
|
|
Packit |
e6c7a3 |
the current version of this package, the current documentation, and
|
|
Packit |
e6c7a3 |
pointers to any additional resources.
|
|
Packit |
e6c7a3 |
|
|
Packit |
e6c7a3 |
For bug tracking, use the [CPAN bug
|
|
Packit |
e6c7a3 |
tracker](https://rt.cpan.org/Dist/Display.html?Name=Term-ANSIColor).
|
|
Packit |
e6c7a3 |
However, please be aware that I tend to be extremely busy and work
|
|
Packit |
e6c7a3 |
projects often take priority. I'll save your mail and get to it as soon
|
|
Packit |
e6c7a3 |
as I can, but it may take me a couple of months.
|
|
Packit |
e6c7a3 |
|
|
Packit |
e6c7a3 |
## Source Repository
|
|
Packit |
e6c7a3 |
|
|
Packit |
e6c7a3 |
Term::ANSIColor is maintained using Git. You can access the current
|
|
Packit |
e6c7a3 |
source on [GitHub](https://github.com/rra/ansicolor) or by cloning the
|
|
Packit |
e6c7a3 |
repository at:
|
|
Packit |
e6c7a3 |
|
|
Packit |
e6c7a3 |
https://git.eyrie.org/git/perl/ansicolor.git
|
|
Packit |
e6c7a3 |
|
|
Packit |
e6c7a3 |
or [view the repository on the
|
|
Packit |
e6c7a3 |
web](https://git.eyrie.org/?p=perl/ansicolor.git).
|
|
Packit |
e6c7a3 |
|
|
Packit |
e6c7a3 |
The eyrie.org repository is the canonical one, maintained by the author,
|
|
Packit |
e6c7a3 |
but using GitHub is probably more convenient for most purposes. Pull
|
|
Packit |
e6c7a3 |
requests are gratefully reviewed and normally accepted. It's probably
|
|
Packit |
e6c7a3 |
better to use the CPAN bug tracker than GitHub issues, though, to keep all
|
|
Packit |
e6c7a3 |
Perl module issues in the same place.
|
|
Packit |
e6c7a3 |
|
|
Packit |
e6c7a3 |
## License
|
|
Packit |
e6c7a3 |
|
|
Packit |
e6c7a3 |
The Term::ANSIColor package as a whole is covered by the following
|
|
Packit |
e6c7a3 |
copyright statement and license:
|
|
Packit |
e6c7a3 |
|
|
Packit |
e6c7a3 |
> Copyright 1996-1998, 2000-2002, 2005-2006, 2008-2016
|
|
Packit |
e6c7a3 |
> Russ Allbery <rra@cpan.org>
|
|
Packit |
e6c7a3 |
>
|
|
Packit |
e6c7a3 |
> Copyright 1996
|
|
Packit |
e6c7a3 |
> Zenin
|
|
Packit |
e6c7a3 |
>
|
|
Packit |
e6c7a3 |
> Copyright 2012
|
|
Packit |
e6c7a3 |
> Kurt Starsinic <kstarsinic@gmail.com>
|
|
Packit |
e6c7a3 |
>
|
|
Packit |
e6c7a3 |
> This program is free software; you may redistribute it and/or modify it
|
|
Packit |
e6c7a3 |
> under the same terms as Perl itself. This means that you may choose
|
|
Packit |
e6c7a3 |
> between the two licenses that Perl is released under: the GNU GPL and the
|
|
Packit |
e6c7a3 |
> Artistic License. Please see your Perl distribution for the details and
|
|
Packit |
e6c7a3 |
> copies of the licenses.
|
|
Packit |
e6c7a3 |
>
|
|
Packit |
e6c7a3 |
> PUSH/POP support submitted 2007 by openmethods.com voice solutions
|
|
Packit |
e6c7a3 |
|
|
Packit |
e6c7a3 |
Some files in this distribution are individually released under different
|
|
Packit |
e6c7a3 |
licenses, all of which are compatible with the above general package
|
|
Packit |
e6c7a3 |
license but which may require preservation of additional notices. All
|
|
Packit |
e6c7a3 |
required notices, and detailed information about the licensing of each
|
|
Packit |
e6c7a3 |
file, are recorded in the LICENSE file.
|
|
Packit |
e6c7a3 |
|
|
Packit |
e6c7a3 |
For any copyright range specified by files in this package as YYYY-ZZZZ,
|
|
Packit |
e6c7a3 |
the range specifies every single year in that closed interval.
|