DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Changing colors

Changing colors for individual users

In general, users should use the scocolor client when they want to modify the colors that are used by the Desktop and other clients. However, there may be circumstances where a user wants to change the color for a particular aspect of the Graphical Environment display without changing the colors defined in the current palette. For example, a user may run the scoedit client often and want the background of the scoedit window to be a unique color so it stands out on the display. Another user might want the background of all non-active window frames to use a different color than the background of the windows themselves. Color changes of this kind should be made using an .Xdefaults-hostname resource file in the individual user's home directory.

Before you actually make any color resource specifications, however, you should be familiar with the information in ``Understanding resources''.

The following procedure can be undertaken by either root or an individual user. To change the color settings for a particular aspect of a client, perform the following steps.

  1. Create a file called .Xdefaults-hostname in the user's home directory.

  2. Edit the .Xdefaults-hostname file and add the new color resource specification, using the following format:

    client*resource_name: color

    Save your changes and exit the resource file when you are finished.

  3. If you created the .Xdefaults-hostname file as root, assign the appropriate user permissions to the file:

    chown username .Xdefaults-hostname
    chgrp groupname .Xdefaults-hostname

  4. Start a Graphical Environment session.

Step 1: Creating an .Xdefaults-hostname file

Individual users can assign their own color values, instead of palette resource variables, to color resources. A resource that uses a specific color value always has precedence over the same resource set with a palette resource variable.

Specific color resource settings are placed in a file called .Xdefaults-hostname, where hostname is the name of the host, or machine, where the client is running. This file must be located in the user's home directory.

You can add an .Xdefaults-hostname file to a user's home directory in one of two ways:



NOTE: Lines in the resource files in the app-defaults directory do not specify the client, because each file applies to only one client. If you create an .Xdefaults-hostname file by copying the relevant lines from a file in the app-defaults directory, be sure to add the client's class or instance name to the beginning of each line if it is not already there. Otherwise the color resource specification will affect all clients.

When the user invokes a client, the client checks to see if an .Xdefaults-hostname file exists in $HOME. If such a file does exist, the resource values specified in the user resource file take precedence over any values assigned to the same resource in the resource database.

See also:

Step 2: Setting the color resource

As with all resources, color resource specifications must use the correct format:

client*resource_name: color

client refers to the client you want to affect. You can supply either the client's binary or class name. resource_name is the actual resource variable you want to define. You can use either the resource's class or instance name. color is either the name of the color you are selecting or the color's hexadecimal RGB values. If you enter a color name, it must match an entry in the rgb.txt file. Hexadecimal RGB values, however, do not have to exist in the color database.

There are many resources that control the colors used for the Graphical Environment. ``Common color resources'' lists the most commonly used color resources. For a more complete list of color resources that are valid for a client, refer to the client's manual page.

Common color resources

Resource name Default value Effect
Class: Foreground    
*foreground scoForeground Color of text in windows
*activeForeground scoActiveForeground Color of text in active window frame
*bottomShadowColor Black Bottom shadow color of window frame
*activeBottomShadowColor Black Bottom shadow color of active window frame
*normal*foreground Black Color of text in Desktop icon labels
Class: Background    
*background scoBackground Window background color
*activeBackground scoActiveBackground Color of background in active window frame
*topShadowColor scoTopShadow Top shadow color of window frame
*activeTopShadowColor scoActiveTopShadow Top shadow color of active window frame
*back*background scoBackground Directory window background color
*desktop*back*background scoAltBackground Desktop background color
*normal*background White Desktop icon label background color
Note that the resources in this table are grouped by class. If desired, you can set all of the resource instances in a class to the same color value simply by specifying the class in the .Xdefaults-hostname file. For example, to set all instances of the Background class to yellow, specify the following:

client*Background: yellow

Whether you are replacing a palette resource variable with a specific color name or specifying a new, more specific resource, the resource line should use the same format. For example, to specify that the background for a scoedit window should be red, add the following resource line to the .Xdefaults-hostname file:

   ScoEdit*background:  red

See also:

Step 3: Assigning correct ownership permissions

If you generated an .Xdefaults-hostname file for a user from the root account, whether by creating the file or by copying the file from files in /usr/lib/X11/app-defaults, you must assign the file the correct ownership permissions. Run the chown command to assign the correct owner and the chgrp command to assign the correct group to the .Xdefaults-hostname file.

If you created your own .Xdefaults-hostname file, you can omit this step. Your ownership permissions are already correct.

Step 4: Starting a Graphical Environment session

To see your new color settings, start a Graphical Environment session, either through scologin or by running startx from the command line.

Run the desired clients. When a client is started, it reads the $HOME/.Xdefaults-hostname file for your personal resource specifications. The new color settings are noted and specified colors are displayed accordingly.

If you created your own .Xdefaults-hostname file while running a Graphical Environment session, and you want the new color values applied to clients that are currently running, you need to restart the clients.

If you want the Desktop client to reflect your new color specifications, you must end your session and then start the X server again, either by logging in through a scologin window or by running the startx script from the command line.


Next topic: Setting colors from the command line
Previous topic: Step 2: Adding the new palette

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