(* Copyright (C) 1992, Digital Equipment Corporation *) (* All rights reserved. *) (* See the file COPYRIGHT for a full description. *) (* *) (* Last modified on Sun Aug 16 1:06:42 PDT 1992 by meehan *) MakeBasicTable is a utility that reads a file of color-names and values, and writes the contents of ColorNameTable.i3. It reads from stdin and prints to stdout, so a good way to use it is: MakeBasicTable < rgb.txt > ColorNameTable.i3 You should definitely look at ColorNameTable.i3 before moving it to ../../src/ColorNameTable.i3, which is where the "real" version lives. The file rgb.txt is simply /usr/lib/X11/rgb.txt with these lines added: 247 247 181 GOLDENROD YELLOW 128 160 70 OLIVE GREEN 239 302 133 OLIVE GREEN 1 223 282 123 OLIVE GREEN 2 192 243 107 OLIVE GREEN 3 130 165 72 OLIVE GREEN 4 That was necessary because the file refers to "Light GoldenRod Yellow" without defining "Goldenrod Yellow", and "Dark Olive Green" without defining "Olive Green". The program makes 3 "passes". It uses the existing ColorName and ColorNameF interfaces -- ColorNameF was created precisely so that MakeBasicTable could do this -- but it clears the color table and the name cache so that it won't use any of the existing values. In pass 2, it puts all the "basic names" (without modifiers like "very" and "dark") into the table and puts all the other names on a list. If it finds a name defined more than once with different RGB values, it writes an error message to stderr. In pass 2, it looks up all the name on the list. Presumably, they're all modified versions of colors now in the table. If it finds one that isn't, it prints it out on stderr ("RealLemon ???"). There shouldn't be any of these, but if there are, you can either ignore them or patch the rgb.txt file and try again. The additions I made for Goldenrod Yellow and Olive Green are patches. (Given the RGB numbers for Light GoldenRod Yellow, I figured out what (plain) Goldenrod Yellow would have to be in order to get those values. If you do this, remember that you have to gamma-convert the RGB values!) In pass 3, it sorts the colors by name and writes the contents of ColorNameTable.i3 onto stdout.