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

I've been having a good romp getting familiar with the Curses module in preparation for building a spiffy UI for an admin tool that has outgrown its command line interface. I've made much progress. Found lots of nice control over colors and text attributes. Alternate char set with box graphics chars. Etc...

But one thing eludes me. I can find no way to produce Color-on-TrueWhite text on a can_change_color()==0 terminal. What Curses calls "White" is actually Gray or OffWhite. You can bold that in the foreground to get TrueWhite text on a darker background. And setting a default of Black-on-TrueWhite is possible with a trick I stumbled upon. But I can find no way to produce Red-on-TrueWhite or Green-on-TrueWhite once a default has been set.

Before you point me to init_color(...) let me mention again that can_change_color() returns 0 on the setups where this will run (RedHad 7.n).

Is there hope? Here's some code to play with...

#!/usr/bin/perl -w use strict; use Curses; initscr(); start_color(); noecho(); cbreak(); # No input buffering assume_default_colors(COLOR_BLACK, 8); # True White bg! Why? init_pair(1, COLOR_BLUE, COLOR_RED); init_pair(2, COLOR_RED, COLOR_WHITE); # Actually OFF-White init_pair(3, COLOR_RED, 8); # Produces Black on Black my $win = new Curses; my $row = 0; $win->addstr($row++, 0, "Black on White"); attron( $win, COLOR_PAIR(1) ); $win->addstr($row++, 0, "Blue on Red"); attron( $win, COLOR_PAIR(2) ); $win->addstr($row++, 0, "Red on Off-White"); attron( $win, COLOR_PAIR(3) ); $win->addstr($row++, 0, "Red on True White? No! (All Black)"); attron( $win, COLOR_PAIR(1) ); $win->addstr($row++, 0, "Blue on Red again"); attroff( $win, COLOR_PAIR(1) ); $win->addstr($row++, 0, "Hit any key: "); $win->refresh(); my $ch = $win->getch(); endwin(); __END__ Color Reference: 0 COLOR_BLACK 4 COLOR_BLUE 1 COLOR_RED 5 COLOR_MAGENTA 2 COLOR_GREEN 6 COLOR_CYAN 3 COLOR_YELLOW 7 COLOR_WHITE

------------------------------------------------------------
"Perl is a mess and that's good because the
problem space is also a mess.
" - Larry Wall