++ed by:

1 non-PAUSE user.

Paul Miller


Term::ANSIColorx::ColorNicknames - nicknames for the ANSI colors


    # use Term::ANSIColor qw(color colorvalid);
    use Term::ANSIColorx::ColorNicknames qw(color colorvalid);


I have a hard time remembering the ANSI colors in terms of bolds and regulars, and also find them irritating to type. If I want the color yellow, why should I have to type "bright_yellow" to get it? yellow is really orange colored, yellow should always be bold.


In the past, this module used to replace the exports of the Term::ANSIColor package. I was under the impression I am the only user of this package, so I felt comfortable breaking backwards compatability with versions prior to 2.7187. Lemme know if I jacked up your codes, but please adapt to the new setup. The old stuff was pretty janky. Kinda cool scope hacking, but janky.

This module exports the following functions, which “override” the functions from Term::ANSIColor. They use the word “fix” instead of translate because it’s short, not because it’s a political statement about the ANSI definitions or Term::ANSIColor.


Re-writes the (correct) ANSI color to the new nickname color. Additionally, it re-writes various easy to type natural language (or css feeling) punctuations.

    "bold blue" eq fix_color("sky")

    "bold white on_blue" eq fix_color("bold-white on blue")

Note that white is really "bold white" under this package. fix_color automatically fixes "bold bold white" should it come up by accident. Actually, it tries to do something predictable when you use bold/faint/dark/bright in any combination. It just uses the first one.

    "bold blue" eq fix_color("bold dark bold faint dark bold blue");
    "dark blue" eq fix_color("dark bold bold faint dark bold blue");

clear (aka normal aka unbold) is an exception to this rule. If clear (aka normal etc) is the only “color” in the color, then it stands, otherwise, it is removed — presuming that a reset is usually used after some color sequence anyway..

    "bold black" eq fix_color("coal");
    "black"      eq fix_color("normal coal");
    "clear"      eq fix_color("normal");

Which means, you get the following. Notice that we get \e[30m, not \e[0;30m like you might expect.

    say "result: "
        map { colored( " $_ ", $_ ) }

        "normal coal",


    result: [
      "\e[1;30m coal \e[0m",
      "\e[30m normal coal \e[0m",
      "\e[0m clear \e[0m",

Additionally, fix_color uses the prototype _, so one can do this:

    @xlated = map{fix_color} qw(sky ocean blood umber);

which gives:

    ("bold blue", "cyan", "red", "bold red")

and of course, this:

    "bold blue" eq fix_color "sky";

Lastly, there's a secret code to disable the re-writing. If you decide you hate one of the nicknames, or just want to disable it for a single color, intoduce a bell character anywhere in the string.

    "bold black" eq fix_color "coal";
    "black" eq fix_color "\ablack";

(This makes more sense if you export "color" below.


This is just an export of "color" in Term::ANSIColor. It runs "fix_color()" on the given string and then invokes Term::ANSIColor::color(). Additionally, color() is defined with the _ prototype, which means it can be invoked this way:

    say color "violet", "test test test test", color "reset"

Or like this:

    while(<$colorstream>) {
        print color if colorvalid;
        say "TEST: o rly? (color=$_)";

    print color("reset");

Like above, this is just a _ prototyped and fix_color() translated export of "colorvalid" in Term::ANSIColor.


Translated (but not _ prototyped) export of "colored" in Term::ANSIColor.


Boring re-import of "colorstrip" in Term::ANSIColor. This is not translated or prototyped.


Boring re-import of "uncolor" in Term::ANSIColor. This is not translated or prototyped.



Alias for the color red.


Alias for bold red.


Alias for bold blue.


Replaces the color cyan, which should be very bright.


Alias for ocean.


Cyan is the bold of the ocean. It's a bright cyan color.


Bolded green. It's really a lime color.

orange brown

Orange. Most correctly, what ANSI calls "yellow", but is really more of a brown-orange.


Yellow. Technically bolded yellow.


Alias for magenta. I can never remember which is right, probably thanks to CSS.


Bolded purple.


Bolded purple.

pitch coal

Bolded black.

grey gray

Unbolded white.


Bolded white.


Scary yellow on red warning color.


Scary white on red color.


Iconic black on orange todo coloring.

mc_dir nc_dir

The white on blue directory coloring from Midnight Commander.

mc_file nc_file

The grey on blue file coloring.

mc_exe nc_exe mc_exec nc_exec

The lime on blue executable coloring.

mc_curs nc_curs

The cursor bar black on cyan coloring.

mc_pwd nc_pwd mc_cwd nc_cwd

The black on white coloring of the current directory on the current panel.

normal unbold un-bold

I can never remember that clear is un-bold or normal. dark and bright work ratehr like bold and clear, except that they don't work from real text consoles (they're really half-bold and extra-bold).


    Q: This is dumb.
    A: Yeah. OK, you have a point. Sorry?


You can report bugs either via rt.cpan.org or via the issue tracking system on github. I'm likely to notice either fairly quickly.


Paul Miller <jettero@cpan.org>


Copyright 2014 Paul Miller -- released under the GPL


perl(1), Term::ANSIColor