installed_progs.t: Python checks stdout too, 150 ok
[sunny256-utils.git] / 256colors2.pl
blobc2b8fe78f4ad3faee4da8eb5d611d69030e4fe35
1 #!/usr/bin/env perl
2 # Author: Todd Larason <jtl@molehill.org>
3 # $XFree86: xc/programs/xterm/vttests/256colors2.pl,v 1.2 2002/03/26 01:46:43 dickey Exp $
5 # use the resources for colors 0-15 - usually more-or-less a
6 # reproduction of the standard ANSI colors, but possibly more
7 # pleasing shades
9 # colors 16-231 are a 6x6x6 color cube
10 for ($red = 0; $red < 6; $red++) {
11 for ($green = 0; $green < 6; $green++) {
12 for ($blue = 0; $blue < 6; $blue++) {
13 printf("\x1b]4;%d;rgb:%2.2x/%2.2x/%2.2x\x1b\\",
14 16 + ($red * 36) + ($green * 6) + $blue,
15 ($red ? ($red * 40 + 55) : 0),
16 ($green ? ($green * 40 + 55) : 0),
17 ($blue ? ($blue * 40 + 55) : 0));
22 # colors 232-255 are a grayscale ramp, intentionally leaving out
23 # black and white
24 for ($gray = 0; $gray < 24; $gray++) {
25 $level = ($gray * 10) + 8;
26 printf("\x1b]4;%d;rgb:%2.2x/%2.2x/%2.2x\x1b\\",
27 232 + $gray, $level, $level, $level);
31 # display the colors
33 # first the system ones:
34 print "System colors:\n";
35 for ($color = 0; $color < 8; $color++) {
36 print "\x1b[48;5;${color}m ";
38 print "\x1b[0m\n";
39 for ($color = 8; $color < 16; $color++) {
40 print "\x1b[48;5;${color}m ";
42 print "\x1b[0m\n\n";
44 # now the color cube
45 print "Color cube, 6x6x6:\n";
46 for ($green = 0; $green < 6; $green++) {
47 for ($red = 0; $red < 6; $red++) {
48 for ($blue = 0; $blue < 6; $blue++) {
49 $color = 16 + ($red * 36) + ($green * 6) + $blue;
50 print "\x1b[48;5;${color}m ";
52 print "\x1b[0m ";
54 print "\n";
58 # now the grayscale ramp
59 print "Grayscale ramp:\n";
60 for ($color = 232; $color < 256; $color++) {
61 print "\x1b[48;5;${color}m ";
63 print "\x1b[0m\n";