nornagon has asked for the wisdom of the Perl Monks concerning the following question:

Hi. I began using Term::Visual not so long ago, and one of my pet peeves about it is that it tries to be smart and use the terminal's color8 ('white'--actually greyish) rather than its default foreground color ("\033[0m").

Anyone know how I can force Term::Visual or Curses to generate the terminal's default color rather than 'white'?

I'm trying to make something that looks like irssi, but that particular problem just keeps getting at me.

Replies are listed 'Best First'.
Re: Term::Visual colors
by jbrugger (Parson) on Dec 31, 2004 at 09:39 UTC
    I'm not sure if this fits your needs, but after some searching, i did not find any regular way to do this. Therefore I'd search for a scheme-file, like for xterm from kde in /usr/share/apps/konsole. Read that file in perl, and set the colors manually.
Re: Term::Visual colors
by zentara (Cardinal) on Dec 31, 2004 at 13:56 UTC
    First thought: edit the module to not do it?

    I am no expert on this, but I was screwing around installing ncurses awhile back, and one of the tips I came across is that you can start xterm with a user defined terminfo type like " xterm -tn xterm-color ". Now in /usr/share/terminfo/x there are a bunch of definitions for xterm, maybe try a few of them. I think there is a way to define your own too, with the program 'tic'.

    Once you find the right one, you can define it and add it to your .Xresources file like:

    You can tell *xterm* to do that by adding #ifdef *COLOR* *XTerm**termName: *xterm*-*color* #endif to your .Xresources file (or whatever file is being fed to xrdb to set resources). If you're not using anything, then echo '*XTerm**termName: *xterm*-*color*' | xrdb in .xinitrc - before you start any xterms - will do the job, except that will also set it in the unlikely event that you are on an X server that doesn't support *color*.
    I'm in over my head here, so I suggest you do a groups.google search yourself for "terminfo linux".

    I'm not really a human, but I play one on earth. flash japh
      I've looked through the module to try to find the way it sets colors, but it seems to use Curses's abstraction layer. Which, from perldoc Curses, I gather doesn't support a "normal" color. Printing "\033[0m" doesn't help, either. It just appears as a literal =[
        Okay, I hacked up Term::Visual a bit and came up with a patch one can apply to Term/Visual.pm:
        @@ -148,6 +148,7 @@ $kernel->alias_set( $alias ); $console = POE::Wheel::Curses->new( InputEvent => 'private_input'); + use_default_colors(); my $old_mouse_events = 0; mousemask(0, $old_mouse_events); @@ -1354,6 +1355,7 @@ re => COLOR_RED, red => COLOR_RED, wh => COLOR_WHITE, white => COLOR_WHITE, ye => COLOR_YELLOW, yellow => COLOR_YELLOW, + de => -1, default => -1, ); my %attribute_table =
        Works a charm now ^_^ you just have to set colors as 'de' or 'default'.