Added /dump/nccolour
BIN
img/nccol-debian.png
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
BIN
img/nccol-fbsd.png
Normal file
|
After Width: | Height: | Size: 4.9 KiB |
BIN
img/nccol-full.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
img/nccol-rox-b.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
img/nccol-rox-c.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
img/nccol-rox-t.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
img/nccol-rox-w.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
img/nccol-xterm.png
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
79
index.cgi
|
|
@ -22,6 +22,7 @@ TUWF::register(
|
|||
qr{demo} => \&dumpdemo,
|
||||
qr{dump/awshrink} => \&dumpawshrink,
|
||||
qr{dump/grenamr} => \&dumpgrenamr,
|
||||
qr{dump/nccolour} => \&dumpnccolour,
|
||||
);
|
||||
TUWF::set(
|
||||
logfile => '/www/err.log',
|
||||
|
|
@ -48,6 +49,7 @@ sub home {
|
|||
E;
|
||||
end;
|
||||
h2 'Updates';
|
||||
b '2011-06-11'; txt ' Added NCurses colour experiment at code dump => nc-colour'; br;
|
||||
b '2011-06-03'; txt ' Added my latest project: ncdc'; br;
|
||||
b '2011-02-07'; txt ' TUWF 0.1 released and now also available on CPAN'; br;
|
||||
b '2011-01-27'; txt ' Documented and uploaded one of my older projects: TUWF'; br;
|
||||
|
|
@ -613,6 +615,80 @@ sub dumpgrenamr {
|
|||
$s->htmlFooter;
|
||||
}
|
||||
|
||||
sub dumpnccolour {
|
||||
my $s = shift;
|
||||
$s->htmlHeader(title => 'Colours in NCurses', page => 'dump', tab => 'nccolour');
|
||||
p;
|
||||
lit <<' E;';
|
||||
I decided to do some experimentation with how the colours defined in
|
||||
ncurses are actually displayed in terminals, what the effects are of
|
||||
combining these colours with other attributes, and how colour schemes of a
|
||||
terminal can affect the displayed colours. To this end I wrote a small c
|
||||
file and ran it in different terminals and different configurations. Note
|
||||
that only the 8 basic NCurses colours are tested, the more flexible
|
||||
init_color() function is not used.
|
||||
E;
|
||||
br;br;
|
||||
b 'Source code: ';
|
||||
a href => '/download/code/nccolour.c', 'nccolour.c';
|
||||
txt " ("; a href => 'http://p.blicky.net/xu35c', 'syntax highlighed version'; txt ')';
|
||||
br;
|
||||
txt 'Some screenshots can be found below, but more screenshots are always
|
||||
welcome! Please send your (.png) screenshots to projects@yorhel.nl.';
|
||||
end;
|
||||
|
||||
h2 'Notes / observations';
|
||||
ul;
|
||||
li 'The most obvious conclusion: the displayed colours do not have the exact
|
||||
same colour value in every terminal. Some terminals also allow users to
|
||||
modify these colours.';
|
||||
li 'You can not assume that the default foreground or background colour can
|
||||
be represented by one of the 8 basic colours defined by NCurses.';
|
||||
li 'Specifying -1 as colour, to indicate the default foreground or
|
||||
background colour, seems to work fine in any terminal tested so far.';
|
||||
li 'All tested terminals render the foreground colour in a lighter shade
|
||||
when the A_BOLD attribute is set. This does not apply to the background
|
||||
colour. The result of this is that the text becomes visible when using
|
||||
A_BOLD when the foreground and background colour are set to the same
|
||||
value.';
|
||||
li 'Unfortunately, not all terminals are configured in such a way that all
|
||||
possible colours are readable. So as a developer you\'ll still have to
|
||||
support configurable colour schemes in your ncurses application. :-(';
|
||||
li 'None of the tested terminals make an attempt to change the foreground
|
||||
colour if it is (almost) invisible on the selected background colour. This
|
||||
can be a good thing or a bad thing, depending on what you want.';
|
||||
end;
|
||||
|
||||
h2 'Full screenshot';
|
||||
p;
|
||||
txt 'To avoid wasting unecessary space, the comparison screenshots below
|
||||
only display the colour table. Here\'s a screenshot of the full output of
|
||||
the program, which also explains what each column means.';
|
||||
br;
|
||||
img style => 'margin: 10px 0 0 25px', src => "/img/nccol-full.png";
|
||||
end;
|
||||
|
||||
h2 'Screenshots';
|
||||
my @img = (
|
||||
'rox-b' => 'Arch Linux, Roxterm, Default color scheme',
|
||||
'rox-w' => 'Arch Linux, Roxterm, GTK color scheme',
|
||||
'rox-t' => 'Arch Linux, Roxterm, Tango color scheme',
|
||||
'rox-c' => 'Arch Linux, Roxterm, Modified Tango color scheme',
|
||||
xterm => 'Arch Linux, xterm (default settings)',
|
||||
debian => 'Debian Squeeze, VT (default settings)',
|
||||
fbsd => 'FreeBSD, VT (default settings)',
|
||||
);
|
||||
while(@img) {
|
||||
my($n, $t) = (shift(@img), shift(@img));
|
||||
txt $t;
|
||||
br;
|
||||
img style => 'margin: 5px 0 10px 25px; border: 1px solid #999', src => "/img/nccol-$n.png", alt => "NCurses colours on $t";
|
||||
br;
|
||||
}
|
||||
|
||||
$s->htmlFooter;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -682,7 +758,8 @@ sub htmlHeader {
|
|||
a href => '/dump', !$o{tab} ? (class => 'sel') : (), 'misc'; txt ' ';
|
||||
a href => '/demo', $o{tab} eq 'demo' ? (class => 'sel') : (), 'demos'; txt ' ';
|
||||
a href => '/dump/awshrink', $o{tab} eq 'awshrink' ? (class => 'sel') : (), 'awshrink'; txt ' ';
|
||||
a href => '/dump/grenamr', $o{tab} eq 'grenamr' ? (class => 'sel') : (), 'grenamr';
|
||||
a href => '/dump/grenamr', $o{tab} eq 'grenamr' ? (class => 'sel') : (), 'grenamr'; txt ' ';
|
||||
a href => '/dump/nccolour', $o{tab} eq 'nccolour' ? (class => 'sel') : (), 'nc-colour';
|
||||
end;
|
||||
}
|
||||
div id => 'main';
|
||||
|
|
|
|||