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
# download from http://www.frexx.de/xterm-256-notes/data/256colors2.pl
7
# use the resources for colors 0-15 - usually more-or-less a
8
# reproduction of the standard ANSI colors, but possibly more
11
# colors 16-231 are a 6x6x6 color cube
12
for ($red = 0; $red < 6; $red++) {
13
for ($green = 0; $green < 6; $green++) {
14
for ($blue = 0; $blue < 6; $blue++) {
15
printf("\x1b]4;%d;rgb:%2.2x/%2.2x/%2.2x\x1b\\",
16
16 + ($red * 36) + ($green * 6) + $blue,
17
($red ? ($red * 40 + 55) : 0),
18
($green ? ($green * 40 + 55) : 0),
19
($blue ? ($blue * 40 + 55) : 0));
24
# colors 232-255 are a grayscale ramp, intentionally leaving out
26
for ($gray = 0; $gray < 24; $gray++) {
27
$level = ($gray * 10) + 8;
28
printf("\x1b]4;%d;rgb:%2.2x/%2.2x/%2.2x\x1b\\",
29
232 + $gray, $level, $level, $level);
35
# first the system ones:
36
print "System colors:\n";
37
for ($color = 0; $color < 8; $color++) {
38
print "\x1b[48;5;${color}m ";
41
for ($color = 8; $color < 16; $color++) {
42
print "\x1b[48;5;${color}m ";
47
print "Color cube, 6x6x6:\n";
48
for ($green = 0; $green < 6; $green++) {
49
for ($red = 0; $red < 6; $red++) {
50
for ($blue = 0; $blue < 6; $blue++) {
51
$color = 16 + ($red * 36) + ($green * 6) + $blue;
52
print "\x1b[48;5;${color}m ";
60
# now the grayscale ramp
61
print "Grayscale ramp:\n";
62
for ($color = 232; $color < 256; $color++) {
63
print "\x1b[48;5;${color}m ";