The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

PortageXS::Colors - Colour formatting / translation for Gentoo

VERSION

version 0.3.1

METHODS

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

Emit a color code, turning on that colour for all future printing

    $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" )

Its printTaskColored, but shorter and 'ok' is implied

    $colors->printTaskColored( 'ok', $message );
    $colors->print_ok( $message ); # Easy

Its printTaskColored, but shorter and 'err' is implied

    $colors->printTaskColored( 'err', $message );
    $colors->print_err( $message ); # Easy

Its printTaskColored, but shorter and 'info' is implied

    $colors->printTaskColored( 'info', $message );
    $colors->print_err( $message ); # Easy

ATTRIBUTES

color_YELLOW

color_GREEN

color_LIGHTGREEN

color_WHITE

color_CYAN

color_RED

color_BLUE

color_RESET

task_color_ok

task_color_err

task_color_info

AUTHORS

  • Christian Hartmann <ian@gentoo.org>

  • Torsten Veller <tove@gentoo.org>

  • Kent Fredric <kentnl@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2013 by Christian Hartmann.

This is free software, licensed under:

  The GNU General Public License, Version 2, June 1991