
Color::Output - Module to give color to the output

With this module you can color the output. It will color the output on both Windows and on Unix/Linux. On Windows it uses by default Win32::Console (unless overwritten with some options), on Unix/Linux it uses ANSI by default.
This module allows you to do:

Initialise this module, this should be done before doing anything else with this module.
By default it will use ANSI-Colors on Linux/Unix and Win32::Console on windows.
However, you can change this behaviour by changing the value of several variables, more about that in the Vars-Section
Display the text on the screen. The char to identify a color is: \x03 or \003 or chr(3) (by default)
All params are joined into 1 string.
Examples:
cprint ("\x033Blue text\x030\n");
cprint ("\0035Red text\n");
cprint ("The text is still red, ", chr(3) ,"7and now it is green.\x030\n");
Note:
The text-color is set to the default one when the program ends.
Display the text on the screen. The char to identify a color is: \x03 or \003 or chr(3) (by default)
Examples:
cprintf ("\x033This is a %s string\x030\n", "blue");
cprintf ("\0035%s text\n", "red");
cprintf ("The text is still %s, ". chr(3) ."7and now it is %s.\x030\n", "red", "green");
Note1:
If you call cprintf, then it runs sprintf and that result is printed with cprint. However, I'm not sure wheter or not this is very safe.. so you might want to pay attention when you use it.
Clears the screen.
Example:
clear();

With this variable you can change the way this module behaves.
By default ANSI-Colors will be used on Linux/Unix and Win32::Console on Win32.
If you change this var to 1 then ANSI-Colors will be used,
If you set it to 2 then Win32::Console will be used.
Examples: examples/ANSI.pl and examples/W32.pl
This is the symbol you can use to color your text, by default chr(3) will be used.
Example: examples/symbol.pl

use Color::Output;
Color::Output::Init;
for (my($i)=0;$i<16;$i++) {
cprint("Color=$i". (" " x (15 - length($i))) ."\x03" . $i . "Example $0, color $i\x030\n");
}
This code is also added as an example (examples/colors.pl)


Term::ANSIColor, Win32::Console, Win32::Console::ANSI


Animator <Animator@CQ-Empires.com>

Copyright (c) 2003 Animator. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.