Changing colors

Example 1: Using custom colors in default palettes

Let's assume you are an administrator for a system whose X server and clients are accessed by several users. Your users have asked you to replace the window background color in the default, system-wide palette called Northwoods with a more muted shade of blue, because the current color, as it displays on your monitors, is too bright.

After some experimentation, you decide that none of the shades of blue available in the database will satisfy all of your users, so you create a custom color to resolve the problem. This example covers all aspects of incorporating this color into the Northwoods palette, including how to:

The following steps result in a modified default palette:

  1. Log into the system as root. If you did not log into the root account through a scologin window, start a Graphical Environment session by entering:

    startx &

  2. From a scoterm window, change to the /usr/lib/X11 directory and open the rgb.txt file for editing.

  3. Because your new color is a shade of blue, locate the section of the rgb.txt file that defines blue colors. This section starts with the following entry:
       25 25 112     midnight blue

  4. Within the blue section, open a line and enter the RGB values and the name for your custom color. Color names are separated from the RGB values by a tab.

    For this example, enter:

    184  216  255 alpine blue

    Because the color name in this example consists of two words, you should also enter the following:

    184  216  255 Alpine Blue

  5. Save and exit the rgb.txt file.

  6. Recompile the color database with the rgb command so the X server can recognize the new color:

    rgb < rgb.txt

  7. When your prompt returns, run the showrgb command to check that the new color is now listed in the database:

    showrgb | grep alpine

    This command produces the definition line for the Alpine Blue color. Remember to use lowercase letters when greping for a color name with the showrgb client.

  8. You are now ready to modify the Northwoods palette and add your new color. Change directories to /usr/lib/X11/sco/ScoColor and look for the file named palettes. This file contains all of the system-wide palette definitions.

  9. Make a backup copy of the palettes file, in case you should want to return to the original Northwoods palette some day:

    cp palettes palettes.old

  10. Open the palettes file for editing and search for the Northwoods palette definition. You should see:
       172    199    224
       52     0      0
       255    241    241
       158    228    151
       16     86     124
       255    238    255
       255    220    180
       255    148    48

  11. The window background color is defined by the Background color button. The color for this button is specified in the second line of the Northwoods palette definition. Replace the second line, which reads 172 199 224, with the RGB values for the new color, using tabs to separate the three columns:

    184 216 255

  12. Save and exit the palettes file.

  13. To verify that you correctly modified the Northwoods palette, run the scocolor client and select the Northwoods palette. You should see a much more pleasing shade of blue for the backgrounds of your windows.

Next topic: Example 2: Customizing colors with resources
Previous topic: Examples of changing colors

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003