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
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
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);
33 # first the system ones:
34 print "System colors:\n";
35 for ($color = 0; $color < 8; $color++) {
36 print "\x1b[48;5;${color}m ";
39 for ($color = 8; $color < 16; $color++) {
40 print "\x1b[48;5;${color}m ";
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 ";
58 # now the grayscale ramp
59 print "Grayscale ramp:\n";
60 for ($color = 232; $color < 256; $color++) {
61 print "\x1b[48;5;${color}m ";