1#!/usr/bin/perl 2# $XTermId: 88colres.pl,v 1.17 2007/06/08 23:57:23 tom Exp $ 3# ----------------------------------------------------------------------------- 4# this file is part of xterm 5# 6# Copyright 1999-2005,2007 by Thomas E. Dickey 7# Copyright 1999-2000 by Steve Wall 8# 9# All Rights Reserved 10# 11# Permission is hereby granted, free of charge, to any person obtaining a 12# copy of this software and associated documentation files (the 13# "Software"), to deal in the Software without restriction, including 14# without limitation the rights to use, copy, modify, merge, publish, 15# distribute, sublicense, and/or sell copies of the Software, and to 16# permit persons to whom the Software is furnished to do so, subject to 17# the following conditions: 18# 19# The above copyright notice and this permission notice shall be included 20# in all copies or substantial portions of the Software. 21# 22# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 23# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 24# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 25# IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY 26# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 27# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 28# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 29# 30# Except as contained in this notice, the name(s) of the above copyright 31# holders shall not be used in advertising or otherwise to promote the 32# sale, use or other dealings in this Software without prior written 33# authorization. 34# ----------------------------------------------------------------------------- 35# Made from 256colres.pl 36 37# Construct a header file defining default resources for the 38# 88-color model of xterm. 39 40# use the resources for colors 0-15 - usually more-or-less a 41# reproduction of the standard ANSI colors, but possibly more 42# pleasing shades 43 44use strict; 45 46our ( $line1, $line2, $line3 ); 47our ( $red, $green, $blue, $gray ); 48our ( $level, $code, @steps ); 49 50print <<EOF; 51/* 52 * This header file was generated by $0 53 */ 54/* \$XTermId\$ */ 55 56#ifndef included_88colres_h 57#define included_88colres_h 58 59EOF 60 61$line1="COLOR_RES(\"%d\","; 62$line2="\tscreen.Acolors[%d],"; 63$line3="\tDFT_COLOR(\"rgb:%2.2x/%2.2x/%2.2x\")),\n"; 64@steps=(0,139,205,255); 65 66# colors 16-79 are a 4x4x4 color cube 67for ($red = 0; $red < 4; $red++) { 68 for ($green = 0; $green < 4; $green++) { 69 for ($blue = 0; $blue < 4; $blue++) { 70 $code = 16 + ($red * 16) + ($green * 4) + $blue; 71 printf($line1, $code); 72 printf($line2, $code); 73 printf($line3, 74 int (@steps[$red]), 75 int (@steps[$green]), 76 int (@steps[$blue])); 77 } 78 } 79} 80 81# colors 80-87 are a grayscale ramp, intentionally leaving out 82# black and white 83for ($gray = 0; $gray < 8; $gray++) { 84 $level = ($gray * 23.18181818) + 46.36363636; 85 if( $gray > 0 ) { $level += 23.18181818; } 86 $code = 80 + $gray; 87 printf($line1, $code); 88 printf($line2, $code); 89 printf($line3, 90 int($level), int($level), int($level)); 91} 92 93print <<EOF; 94 95#endif /* included_88colres_h */ 96EOF 97