root/foundation-apps/mxterm-maxx/88colres.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: Steve Wall
3# $XTermId: 88colres.pl,v 1.16 2007/06/08 23:57:23 tom Exp $
4# $XFree86: xc/programs/xterm/88colres.pl,v 1.7 2005/09/18 23:48:11 dickey Exp $
5# Made from 256colres.pl
6
7# Construct a header file defining default resources for the
8# 88-color model of xterm.
9
10# use the resources for colors 0-15 - usually more-or-less a
11# reproduction of the standard ANSI colors, but possibly more
12# pleasing shades
13
14use strict;
15
16our ( $line1, $line2, $line3 );
17our ( $red, $green, $blue, $gray );
18our ( $level, $code, @steps );
19
20print <<EOF;
21/*
22 * This header file was generated by $0
23 */
24/* \$XTermId\$ */
25
26#ifndef included_88colres_h
27#define included_88colres_h
28
29EOF
30
31$line1="COLOR_RES(\"%d\",";
32$line2="\tscreen.Acolors[%d],";
33$line3="\tDFT_COLOR(\"rgb:%2.2x/%2.2x/%2.2x\")),\n";
34@steps=(0,139,205,255);
35
36# colors 16-79 are a 4x4x4 color cube
37for ($red = 0; $red < 4; $red++) {
38    for ($green = 0; $green < 4; $green++) {
39        for ($blue = 0; $blue < 4; $blue++) {
40            $code = 16 + ($red * 16) + ($green * 4) + $blue;
41            printf($line1, $code);
42            printf($line2, $code);
43            printf($line3,
44                   int (@steps[$red]),
45                   int (@steps[$green]),
46                   int (@steps[$blue]));
47        }
48    }
49}
50
51# colors 80-87 are a grayscale ramp, intentionally leaving out
52# black and white
53for ($gray = 0; $gray < 8; $gray++) {
54    $level = ($gray * 23.18181818) + 46.36363636;
55    if( $gray > 0 ) { $level += 23.18181818; }
56    $code = 80 + $gray;
57    printf($line1, $code);
58    printf($line2, $code);
59    printf($line3,
60           int($level), int($level), int($level));
61}
62
63print <<EOF;
64
65#endif /* included_88colres_h */
66EOF
Note: See TracBrowser for help on using the browser.