root/foundation-apps/mxterm-maxx/256colres.pl

Revision 8, 1.6 KB (checked in by emasson, 3 years ago)

initial import for the community edition

Line 
1#! /usr/bin/perl
2# Author: Thomas E. Dickey
3# $XTermId: 256colres.pl,v 1.15 2007/06/08 23:58:37 tom Exp $
4# $XFree86: xc/programs/xterm/256colres.pl,v 1.8 2002/10/05 17:57:11 dickey Exp $
5
6# Construct a header file defining default resources for the 256-color model
7# of xterm.  This is modeled after the 256colors2.pl script.
8
9# use the resources for colors 0-15 - usually more-or-less a
10# reproduction of the standard ANSI colors, but possibly more
11# pleasing shades
12
13use strict;
14
15our ( $line1, $line2, $line3 );
16our ( $red, $green, $blue, $gray );
17our ( $level, $code, @steps );
18
19print <<EOF;
20/*
21 * This header file was generated by $0
22 */
23/* \$XTermId\$ */
24
25#ifndef included_256colres_h
26#define included_256colres_h
27
28EOF
29
30$line1="COLOR_RES(\"%d\",";
31$line2="\tscreen.Acolors[%d],";
32$line3="\tDFT_COLOR(\"rgb:%2.2x/%2.2x/%2.2x\")),\n";
33
34# colors 16-231 are a 6x6x6 color cube
35for ($red = 0; $red < 6; $red++) {
36    for ($green = 0; $green < 6; $green++) {
37        for ($blue = 0; $blue < 6; $blue++) {
38            $code = 16 + ($red * 36) + ($green * 6) + $blue;
39            printf($line1, $code);
40            printf($line2, $code);
41            printf($line3,
42                   ($red ? ($red * 40 + 55) : 0),
43                   ($green ? ($green * 40 + 55) : 0),
44                   ($blue ? ($blue * 40 + 55) : 0));
45        }
46    }
47}
48
49# colors 232-255 are a grayscale ramp, intentionally leaving out
50# black and white
51$code=232;
52for ($gray = 0; $gray < 24; $gray++) {
53    $level = ($gray * 10) + 8;
54    $code = 232 + $gray;
55    printf($line1, $code);
56    printf($line2, $code);
57    printf($line3,
58           $level, $level, $level);
59}
60
61print <<EOF;
62
63#endif /* included_256colres_h */
64EOF
Note: See TracBrowser for help on using the browser.