DESCRIPTION

Term::ExtendedColor provides functions for sending so called extended escape sequences to the terminal. This ought to be used with a 256-color compatible terminal; see the NOTES section for a matrix of terminal emulators currently supporting this.

See "COLORS AND ATTRIBUTES" for valid first arguments. Additionally, colors can be specified using their index value:

my $yellow = fg(220, 'Yellow');

If the internal $AUTORESET variable is non-zero (default), every element in the list of strings will be wrapped in escape sequences in such a way that the requested attributes will be set before the string and reset to defaults after the string.

Fall-through attributes can be enabled by setting $AUTORESET to a false value.

Term::ExtendedColor::autoreset( 0 );
my $red = fg('red1', 'Red');
my $green = fg('green1', 'Green');
print "Text after $red is red until $green\n";
print "Text is still green, ", bold('and now bold as well!');
# If you exit now without resetting the colors and attributes, chances are
# your prompt will be messed up.
clear(); # All back to normal

If an invalid attribute is passed, the original data will be returned unmodified.

get_colors()

clear()

When called in scalar context, returns the escape sequence that resets all attributes to their defaults.

When called in void context, prints it directly.

autoreset()

Turn autoreset on/off. Enabled by default.

Term::ExtendedColor::autoreset( 0 ); # Turn off autoreset

bold(@data)

Convenience function that might be used in place of fg('bold', @data);

italic(@data)

Convenience function that might be used in place of fg('italic', @data);

underline(@data)

Convenience function that might be used in place of fg('underline', @data);

inverse(@data)

Reverse video / inverse. Convenience function that might be used in place of fg('inverse', @data);

NOTES

The codes generated by this module complies to the extension of the ANSI colors standard first implemented in xterm in 1999. The first 16 color indexes (0 - 15) is the regular ANSI colors, while index 16 - 255 is the extension. Not all terminal emulators support this extension, though I've had a hard time finding one that doesn't. :)