Parent directory

executable_testcolor

1079 bytes
 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 232-255 are a grayscale ramp, intentionally leaving out
10
11# display the colors
12
13# first the system ones:
14print "ANSI colors:\n";
15for ($color = 0; $color < 8; $color++) {
16	print "\x1b[48;5;${color}m       ";
17}
18print "\x1b[0m\n";
19for ($color = 8; $color < 16; $color++) {
20	print "\x1b[48;5;${color}m       ";
21}
22print "\x1b[0m\n\n";
23
24# now the color cube
25print "Color cube, 6x6x6:\n";
26for ($green = 0; $green < 6; $green++) {
27	for ($red = 0; $red < 6; $red++) {
28		for ($blue = 0; $blue < 6; $blue++) {
29			$color = 16 + ($red * 36) + ($green * 6) + $blue;
30			print "\x1b[48;5;${color}m  ";
31		}
32		print "\x1b[0m ";
33	}
34	print "\n";
35}
36
37# now the grayscale ramp
38print "Grayscale ramp:\n";
39for ($color = 232; $color < 256; $color++) {
40	print "\x1b[48;5;${color}m  ";
41}
42print "\x1b[0m\n";