Utsav Handa > CMD-Colors-0.1 > CMD::Colors

Download:
contribs/CMD-Colors-0.1.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.1   Source  

NAME ^

CMD::Colors - Generate Colorfull text on commandline

SYNOPSIS ^

    use CMD::Colors;

    ##### Example Usage ##### 
    
    ## Prints text with 'RED' color & default background
    Cprint('hello, This is RED text', 'red');                   

    ## Prints text with 'RED' color & 'white' background 
    Cprint('hello, This is RED text', 'red', 'white');    

    ## Prints text with 'RED' color & 'default' background & BOLD text
    Cprint('hello, This is RED text', 'red', 'default', 'bold'); 

    ## Prints text with 'RED' color & 'default' background & 'half_bright' text
    Cprint('hello, This is RED text', 'red', undef, 'half_bright');


    ##### Show all available 'foreground' & 'background' colors - DEMO #####
    foreach my $color (keys %{$COLOR_CODES{'foreground'}}) {
     Cprint("This is $color text", $color);
     print "\n";
     foreach my $bgcolor(keys %{$COLOR_CODES{'background'}}) {
        Cprint("This is $color text with $bgcolor background", $color, $bgcolor);
        print "\n";
      }
     }

DESCRIPTION ^

This module provides functions for generating colorfull text on commandline with perl programs. It can be used to make PERL "CMD" programs more interesting.

*Cprint() function be used for all "print" calls.

Syntax - Cprint("TEXT TO BE Printed", "ForegroundCOLORName", "BackgroundColorName", "TEXT Property");

Supported Colors :: Foreground - black, red, green, brown, blue, magenta, cyan, white Background - black, red, green, brown, blue, magenta, cyan, white

Supported Properties :: 'bold' ## Set bold 'half_bright' ## Set half-bright (simulated with color on a color display) 'underscore' ## Set underscore (simulated with color on a color display) ## (the colors used to simulate dim or underline are set 'blink' ## Set blink 'reverse_video' ## Set reverse video 'reset_mapping' ## Reset selected mapping, display control flag, and toggle ## meta flag (ECMA-48 says "primary font"). 'null_mapping' ## Select null mapping, set display control flag, reset ## toggle meta flag (ECMA-48 says "first alternate font"). 'null-mapping ' ## Select null mapping, set display control flag, set toggle ## meta flag (ECMA-48 says "second alternate font"). The ## toggle meta flag causes the high bit of a byte to be ## toggled before the mapping table translation is done. 'nd_intensity' ## Set normal intensity (ECMA-48 says "doubly underlined") 'n_intensity' ## Set normal intensity 'underline_off' ## Set underline off 'blink_off' ## Set blink off 'reverse_video_off' ## Set reverse video off 'default' ## Set default

** If color/property specified is not supported, default color/property would be used for printing text **

Techinal Details:: This module uses "Linux" console escape and control sequences for generating colorfull text with background colors, It utilizes the "ECMA-48 SGR" sequenceof the SHELL to generate colored text.

AUTHOR Utsav Handa <handautsav@hotmail.com> ^

COPYRIGHT (c) 2009 Utsav Handa. ^

       All rights reserved.  This program is free software; you can redistribute it 
       and/or modify it under the same terms as Perl itself.
syntax highlighting: