Hello
I am using ver 5.10.0.
In the example, I ignore the current background and foreground colors (
because I do not know how to get them...) and force a bold green on a
blue background. Error messages should be bold red on a blue background.
I have added the code in bold e.g. system ("cls");
Issue the color changes at the beginning of your program, and this way
you minimize the effect of the cls command, e.g. you do not loose too
much data already displayed on the screen
HTH
Erich
use strict;
use warnings;
use Win32::Console::ANSI;
use Term::ANSIColor;
use Term::ANSIScreen qw/:color :cursor :screen/;
color 'bold green on blue';
system ("cls");
print "\nPrior to error\n";
print colored ("\nThis is an error\n", 'bold red',);
color 'bold green on blue';
print "\nAfter error\n";
__END__
________________________________
From: Perl Help [mailto:[email protected]]
Sent: Friday, March 27, 2009 3:12 PM
To: Singer, Erich
Cc: Bill Luebkert; [email protected]
Subject: Re: Reset in ANSIColor sets the background to black
Hi,
I tried this code, but it shows the same results in cmd.exe. Also, is
there a way I can read the current background and foreground color of
dos window from perl?
Thanks,
Jai!
On Fri, Mar 27, 2009 at 7:01 AM, Singer, Erich
<[email protected]> wrote:
Hello
Please try
Thanks
Erich
use strict;
use warnings;
use Win32::Console::ANSI;
use Term::ANSIColor;
use Term::ANSIScreen qw/:color :cursor :screen/;
color 'bold green on blue';
print "\nPrior to error\n";
print colored ("\nThis is an error\n", 'bold red',);
color 'bold green on blue';
print "\nAfter error\n";
__END__
________________________________
From: [email protected]
[mailto:[email protected]] On Behalf Of Perl
Help
Sent: Thursday, March 26, 2009 11:33 PM
To: Bill Luebkert
Cc: [email protected]
Subject: Re: Reset in ANSIColor sets the background to black
Hi Bill,
Thanks for your response. DId you try running CLS command after
executing the code. When I do that, it switches my FG/BG color to
default that is White on Black. More so, my code is not showing the same
results as you described. Is there any other file I need to take care
off? Do you want me to send you the screen shot how it looks like when I
run the program?
Thanks once again for your help,
~Jai!
On Thu, Mar 26, 2009 at 3:53 PM, Bill Luebkert
<[email protected]> wrote:
Perl Help wrote:
Hi,
My current DOS background color is white with
Black text. I use ANSIColor module to print error messages in Red color.
I use the Color command and I face two issues:
1. The Red color error message text thats
printed on DOS has black background, instead of white only.
2. On typing CLS the background color changes to
black and text color changes to white.
What is my Expectation:
1. On prinitng the text in red color should not
have the background color black but use the current DOS background
color(White in my case).
2. On doing CLS on DOS, the dos should maintain
its background color(White in my case) rather then setting it to default
black background color.
My Code:
use Win32::Console::ANSI;
use Term::ANSIColor;
print color "Bold Red";
print "ERROR_MSG = xyz";
print color 'reset';
Seems OK to me on 5.8.8 B820. 5.001 & 5.006 on the
modules, resp.
> p test.pl [switched my FG/BG to reverse
(black on white) prior to test
Prior to error [black on white]
ERROR_MSG = xyz [this was red on white]
Done [black on white]
Everything came out fine as near as I can tell.
My code:
use strict;
use warnings;
use Win32::Console::ANSI;
use Term::ANSIColor;
print "Prior to error\n";
print color "Bold Red";
print "ERROR_MSG = xyz\n";
print color 'reset';
print "Done\n";
__END__
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs