Add tests for file-name-directory, etc
[sxemacs] / contrib / show-tty-256-colors.pl
1 #!/usr/bin/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 $
4
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
8
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));
18         }
19     }
20 }
21
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);
28 }
29
30
31 # display the colors
32
33 # first the system ones:
34 print "System colors:\n";
35 for ($color = 0; $color < 8; $color++) {
36     print "\x1b[48;5;${color}m  ";
37 }
38 print "\x1b[0m\n";
39 for ($color = 8; $color < 16; $color++) {
40     print "\x1b[48;5;${color}m  ";
41 }
42 print "\x1b[0m\n\n";
43
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  ";
51         }
52         print "\x1b[0m ";
53     }
54     print "\n";
55 }
56
57
58 # now the grayscale ramp
59 print "Grayscale ramp:\n";
60 for ($color = 232; $color < 256; $color++) {
61     print "\x1b[48;5;${color}m  ";
62 }
63 print "\x1b[0m\n";