HPlogo Using the X Window System > Chapter 8 Using the X Clients

Creating a Custom Color Database with `rgb'

» 

Technical documentation

Complete book in PDF

 » Table of Contents

 » Glossary

 » Index

The rgb.txt, rgb.pag, and rgb.dir files in /etc/X11 make up the color data base for the X Window System. It contains all the named colors and the amount of red, green, and blue needed to make the color. The following lines are from rgb.txt. Note that the red, green, and blue values are given as the decimal equivalents of their hexadecimal values.

Table 8-6 Some Lines from `rgb.txt'.

RedGreenBlueColor Name
4747100MidnightBlue
3535117navy blue
3535117NavyBlue
3535117navy
3535117Navy
114159255sky blue
114159255SkyBlue

 

As the above lines illustrate, several lines are sometimes necessary to account for alternative spellings of the same color.

Depending on your needs, you may want to make your own custom color database modeled after the rgb.txt file.

Hewlett-Packard recommends that your custom color database have a name other than rgb.txt. You can either copy rgb.txt and make your changes, or start with an entirely new file. In either case, the file entries are in the following format:

   redvalue  greenvalue  bluevalue  name

The fields are separated by either tabs or spaces.

The rgb.txt file is the source file used by the rgb client to make two other files that are used by the server: rgb.dir and rgb.pag. If you run rgb without any parameters, it will use rgb.txt. If you want to use your custom database, use the following syntax:

rgb outfile <infile

where infile is the name of your custom database, the text file you created. The rgb client will create outfile.dir and outfile.pag.

To put your new color database into effect, you must add it to your .x11start file. For example, if your new database is composed of the files 2brite.txt, 2brite.dir, and 2brite.pag in the /home/ellen directory, type the following command line to start your X environment:

   .x11start -- -co /home/ellen/2brite

The server assumes the color database is in the /etc/X11 directory unless told otherwise.

Note that recent X11 releases from Hewlett-Packard may contain more than one color database file, each customized for a particular display type for color consistency across display types. To avoid overwriting an existing rgb.txt file, the installation process for X11 does not automatically replace this file in /etc/X11, but installs the new rgb.txt* file(s) in the directory /usr/newconfig or /etc/newconfig/X11R*. You must manually process (using the rgb utility) the desired rgb.txt* file in order to use one of the new versions. You should copy the desired rgb.txt*, rgb.dir, and rgb.pag files to the /etc/X11 directory. You may want to save the existing version of each file in /etc/X11 before copying the new version in.

© 1995 Hewlett-Packard Development Company, L.P.