PortageXS::Colors - Colour formatting / translation for Gentoo
version 0.3.1
getColor
my $colorCode = $colors->getColor('YELLOW');
getTaskColor
my $color = $colors->getTaskColor('ok'); my $colorCode = $colors->getColor($color);
printColor
Emit a color code, turning on that colour for all future printing
$colors->printColor('RED'); print "this is red"
setPrintColor
$colors->setPrintColor('RED'); print "this is red"
printTaskColor
Emit a color code for a given task type, turning on that colour for all future printing
$colors->printTaskColor('ok'); print "this is green"
disableColors
Replace all colours with empty strings.
$colors->disableColors;
restoreColors
Restores factory color settings
$colors->restoreColors;
messageColored
Formats a string to Gentoo message styling
my $message = $color->messageColored( 'RED' , "Hello World" ) $message eq " <RED ON>*<RESET> Hello World"
printColored
Its messageColored, but prints to STDOUT
$color->printColored( 'RED' , "Hello World" )
messageTaskColored
As with messageColored, but takes a task name instead of a color
my $message = $color->messageTaskColored( 'ok' , "Hello World" ) $message eq " <GREEN ON>*<RESET> Hello World"
printTaskColored
Its messageTaskColored, but prints to STDOUT
$colors->printTaskColored( 'ok' , "Hello World" )
print_ok
Its printTaskColored, but shorter and 'ok' is implied
$colors->printTaskColored( 'ok', $message ); $colors->print_ok( $message ); # Easy
print_err
Its printTaskColored, but shorter and 'err' is implied
$colors->printTaskColored( 'err', $message ); $colors->print_err( $message ); # Easy
print_info
Its printTaskColored, but shorter and 'info' is implied
$colors->printTaskColored( 'info', $message ); $colors->print_err( $message ); # Easy
color_YELLOW
color_GREEN
color_LIGHTGREEN
color_WHITE
color_CYAN
color_RED
color_BLUE
color_RESET
Christian Hartmann <ian@gentoo.org>
Torsten Veller <tove@gentoo.org>
Kent Fredric <kentnl@cpan.org>
This software is Copyright (c) 2013 by Christian Hartmann.
This is free software, licensed under:
The GNU General Public License, Version 2, June 1991
To install PortageXS, copy and paste the appropriate command in to your terminal.
cpanm
cpanm PortageXS
CPAN shell
perl -MCPAN -e shell install PortageXS
For more information on module installation, please visit the detailed CPAN module installation guide.