|
|
By experimenting with the RGB slider bars in the scocolor client or with RGB values on your own, you can create colors and shades that are not included in the color database. If you create custom colors that you think might be useful, you should add them to the color database.
Once incorporated in the database, the new colors become available to all users on your system and can be selected through the scocolor client in exactly the same way you would select any of the other default colors in the database. You must be logged into the system as root to perform this task.
To add a custom color to the color database, perform the following steps.
Save and exit the file when you are finished.
To add a new color to the color database, first
include the color name and the color's RGB decimal values
to the rgb.txt file, located in /usr/lib/X11.
Use the following format when adding the color to the file:
Red_value Green_value Blue_value colorname
Red_value, Green_value, and Blue_value represent the percentages of red, green, and blue, respectively, that are used to create the color. These three entries must be specified with a decimal value between 0 and 255, where 255 indicates a color is at full intensity. colorname indicates the name of the color that is associated with the related RGB decimal values. You can use blank spaces or tabs to separate the four fields in an RGB designation.
If the name you choose for your new color
has more than one word or more than
one spelling (for example, gray and grey), you are advised to create
several different entries in the rgb.txt file to
account for these differences. This gives users a
range of flexibility when entering color names in resource
files. Use the same
RGB values for the alternate entries.
For example, you might create a custom color that you
want to name ``light yellow silk.'' You might make the
following entries in rgb.txt:
243 255 162 light yellow silk
243 255 162 LightYellowSilk
In the same way, if you create a color that you want to name
``blue gray,'' you should make the following entries:
94 139 157 blue gray
94 139 157 BlueGray
94 139 157 blue grey
94 139 157 BlueGrey
You can place your custom color definitions anywhere you want in the rgb.txt file. However, the default colors in this file are arranged in groups of similar shades. For example, all shades of blue are grouped together; all shades of pink are grouped together, and so forth. Therefore, it may be advisable to add your new colors within the shade groupings that best match the colors.
When you finish adding your color definitions to the rgb.txt file, save your changes and exit the file.
After you add your new color definitions to the rgb.txt file, you need to run the rgb program to recompile the color database.
The rgb program uses the information in rgb.txt, including your new color definitions, as input and then creates new versions of the rgb.dir and rgb.pag files. You should change to the /usr/lib/X11 directory to run this command.
Enter the following command to recompile the color database:
rgb < rgb.txt
After you recompile the color database, you should check to make sure the new colors are actually recognized in the database.
The showrgb command examines the rgb.dir and rgb.pag files and constructs a list of all the colors it finds in the database. The command then displays this list on your screen. The list includes the names assigned to the colors and the RGB values used to generate the colors. Note that all the color names that are displayed by this command are in lowercase letters only, even if the database recognizes uppercase versions of a color.
Because the colors that are available in the database number
in the hundreds, you should use a paging command, such as
more or pg, when you run showrgb:
/usr/bin/X11/showrgb | more
Your custom colors are now available to all users on the system. All users can select any one of the new colors from the list of available colors displayed by scocolor.