CMD::Colors

Generate Colorful text on command-line
Download

CMD::Colors Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Utsav Handa
  • Publisher web site:
  • http://search.cpan.org/~uhanda/

CMD::Colors Tags


CMD::Colors Description

Generate Colorful text on command-line CMD::Colors is a Perl module that provides functions for generating colorful text on command-line 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, whiteSupported 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.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 " "; foreach my $bgcolor(keys %{$COLOR_CODES{'background'}}) { Cprint("This is $color text with $bgcolor background", $color, $bgcolor); print " "; } } Requirements: · Perl


CMD::Colors Related Software