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