Long-overdue, but I have a working version! I had to:
- Use the latest Curses::UI (v0.9629) with the fix from rt://50142 (here)
- Use only custom colors --- don't try to combine custom colors with standard colors
- Set the color on the Curses::UI instance, the window, and every widget
Et voila, a curses UI with an orange background and white text (tested on Perl 5.26):
use strict;
use warnings;
use Curses::UI '0.9609';
my $cui = Curses::UI->new( -color_support => 1, -clear_on_exit => 1 );
$cui->set_binding( sub { $cui->mainloopExit() }, "\cC" );
# Colors
my $co = $Curses::UI::color_object;
$co->define_color( 'wh', 999, 999, 999 ); # range [1, 999]
# For some reason, I don't seem to be able to mix
# standard colors with custom colors.
$co->define_color( 'orange', 999, 599, 1 );
my $FG = 'wh';
my $BG = 'orange';
my @COLORS = (
( map { ; $_ => $BG } qw(-bg -tbg -bbg -sbg) ),
( map { ; $_ => $FG } qw(-fg -tfg -bfg -sfg) )
);
$cui->set_color_fg($FG);
$cui->set_color_bg($BG);
# Widgets
my $win = $cui->add(
'main-window', 'Window',
-border => 1,
-title => "Ce n'est pas une fenetre",
-titlefullwidth => 1,
@COLORS,
);
$win->add(
'help', 'Label',
-y => 1,
-width => -1,
-reverse => 1,
-paddingspaces => 1,
-text => "Howdy! Press Ctl-C to exit.",
@COLORS,
);
$cui->mainloop;
$cui->leave_curses;
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.