Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
Common Desktop Environment: Advanced User's and System Administrator's Guide > Chapter 15 Administering Application Resources, Fonts, and Colors

Administering Colors

» 

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index

This section describes:

  • How Style Manager sets display colors.

  • Resources used by Style Manager to control desktop color usage.

Color Palettes

A palette consists a group of color sets. The color sets for the current palette are shown in the Style Manager Color dialog box

A file exists for each palette. The paletteDirectories resource specifies the directories containing palette files. By default, this resource contains:

  • Built-in palettes: /usr/dt/palettes

  • System-wide palettes: /etc/dt/palettes

  • Personal palettes: HomeDirectory/.dt/palettes

Color Sets

Each color set in the current palette is represented by a color button in the Style Manager Color dialog box. Each color is identified by a color set ID—a number from 1 to 8.

Figure 15-1 Color set ID values for HIGH_COLOR

Color set ID values for HIGH_COLOR

Each color set is composed of up to five colors. Each color button displays the background color of the color set. The five colors in each color set represent the following display component resources:

foreground

The foreground of an application window or window frame. It is always black or white. This is generally used for text within windows and titles.

background

The background of the application or the window frame.

topShadowColor

The color of the top and left bevels of application controls (such as push buttons) and window frames.

bottomShadowColor

The color of the bottom and right bevels of application controls and window frames.

selectColor

The color that indicates the active state of certain controls, such as active toggles and buttons.

The number of color sets used by each palette is determined by the colorUse resource, which the user can set using the Style Manager Number of Colors To Use dialog box.

Specifying Color Values

Style Manager uses RGB values when writing color information to its palette files. The syntax for RGB numbers is:

#RedGreenBlue

Red, Green, and Blue are hexadecimal numbers, each 1 to 4 digits long, that indicate the amount of that color used. There must be the same number of digits for each of the colors. Thus, valid color values consist of 3, 6, 9, or 12 hexadecimal digits.

For example, white can be specified in any of the following ways:

#fff
#ffffff
#fffffffff
#fffffffffffff

If you set a color resource directly, you can use either the color name or RGB value. The file /usr/lib/X11/
rgb.txt
lists all the named colors.

How Color Sets are Mapped to Resources

The desktop maps color sets to various display elements through resources, and makes the following assignments:

Resource

Display element

activeColorSetId

Active window frame color

inactiveColorSetId

Inactive window frame color

textColorSetId

Text entry areas

primaryColorSetId

Application's main background areas

secondaryColorSetId

Application's menu bar, menus, and dialog boxes

These resources take a color set ID as their value. Coloring display elements with color set IDs allows the element to dynamically change to the new color scheme when a new palette is selected with Style Manager.

You can use these resources for individual applications. For example, the following line shows how you would visually group all dtterm windows by using color set 8 for their primary color.

dtterm*primaryColorSetId:  8

Default Color Set Assignments

The color set IDs used for display elements depends on the Number of Colors setting in Style Manager:

  • High color (8 color sets)—Style Manager setting More Colors for Desktop:

    Color set ID

    Display element

    1

    Active window frame color

    2

    Inactive window frame color

    3

    Unused (by default)

    4

    Text entry areas

    5

    Application's main background areas

    6

    Application's menu bar, menus, and dialog boxes

    7

    Unused by default

    8

    Front Panel background

  • Medium color (4 color sets)—Style Manager setting More Colors for Applications:

    Color set ID

    Display element

    1

    Active window frame color

    2

    Inactive window frame color

    3

    Application and Front Panel background color

    4

    Text entry areas

  • Low color (2 color sets)—Style Manager setting Most Colors for Applications.

    Color set ID

    Display element

    1

    Active window frame, workspace selection buttons

    2

    All other display elements

Controlling Color with Style Manager

You can dynamically change color for desktop applications and other cooperating applications through Style Manager. The foreground and background colors set by Style Manager are available to non-cooperating applications.

  • For a client to respond to Style Manager color changes, the client must be using the desktop Motif library. Clients written with other toolkits cannot change color dynamically in response to Style Manager changes. Color changes for these clients do not take effect until the client is restarted.

  • There must be no other specific color resources applied for the client. This includes user-specified resources, appdefaults, and resources built into the application.

  • Clients can specify primaryColorSetId and secondaryColorSetId resources to use certain colors within a desktop palette.

Number of Colors Used by Style Manager

The number of colors used by Style Manager depends on the values for the following resources:

colorUse

Configures the number of colors the desktop uses

shadowPixmaps

Directs the desktop to replace the two shadow colors with pixmaps

foregroundColor

Specifies if the foreground color changes dynamically.

dynamicColor

Controls whether applications change color when you switch palettes.

Table 15-5 “Number of Desktop Colors” lists the maximum number of colors allocated by the desktop.

Table 15-5 Number of Desktop Colors

Display

Maximum Number of Colors

Number Derived From

B_W

2

Black and white

LOW_COLOR

12

Two color sets times five colors plus black and white

MEDIUM_COLOR

22

Four color sets times five colors plus black and white

HIGH_COLOR

42

Eight color sets times five colors plus black and white

 

To determine the maximum number of colors:

  1. Multiply the number of color sets in the palette by the number of colors within each color set.

  2. Add 2 (for black and white).

However, with the following configuration you would only have ten colors in your palette: four color sets times two colors in each set (background and selectColor) plus black and white:

*colorUse: MEDIUM_COLOR
*shadowPixmaps: True
*foregroundColor: White
NOTE: Multi-color icons use fourteen additional colors.

colorUse Resource

The default value of the colorUse resource is MEDIUM_COLOR. The value of this resource affects the number of color sets used in a palette. Other resources affect the number of colors used to make shadows. The value of the colorUse resource also affects the use of multi-color icons.

Value

Description

B_W

"Black and White" Style Manager setting
Displays with 1 to 3 color planes
Number of color sets: 2
Maximum number of colors: 2
Default number of colors: 2
No multicolor icons

LOW_COLOR

"Most Color for Applications" Style Manager setting
Displays with 4 to 5 color planes
Number of color sets: 2
Maximum number of colors: 12
Default number of colors: 12
No multicolor icons

MEDIUM_COLOR

"More Colors for Application" Style Manager setting
Displays with 6 color planes
Number of color sets: 4
Maximum number of colors: 22
Default number of colors: 22
Multicolor icons

HIGH_COLOR

"More Colors for Desktop" Style Manager setting
Displays with 7 or more color planes
Number of color sets: 8
Maximum number of colors: 42
Default number of colors: 42
Multicolor icons\

default

The desktop chooses the correct value for that display. (To reduce the number of colors used by the desktop for high-color displays, the default colorUse resource is set to MEDIUM_COLOR.)

shadowPixmaps Resource

The shadowPixmaps resource directs the desktop to replace the two shadow colors with pixmaps. These pixmaps mix the background color with black or white to simulate top or bottom shadow values. This reduces the number of needed colors by two, since color cells do not need to be allocated for the shadow colors.

Value

Description

True

The desktop creates a topShadowPixmap and bottomShadowPixmap to use instead of the shadow colors.

False

topShadowColor and bottomShadowColor from the palette are used.

The default value for shadowPixmaps depends on the colorUse resource you have and the hardware support for the display.

foregroundColor Resource

The foregroundColor resource specifies how the foreground is configured in a palette.

Setting

Result

White

Foreground is set to white.

Black

Foreground is set to black.

Dynamic

(Default) Foreground is dynamically set to black or white, depending on the value of background. For instance, white letters on a yellow background are difficult to read, so the system chooses black.

If foregroundColor is set to either Black or White, the number of colors in the color set is reduced by one, and the foreground will not change in response to changes in the background color.

The default value for foregroundColor is Dynamic, except where the value of colorUse is B_W.

dynamicColor Resource

The dynamicColor resource controls whether applications change color dynamically; that is, whether the clients change color when you switch palettes.

Value

Description

True

Clients change color dynamically when a new palette is selected. This is the default value.

False

Clients do not change color dynamically. When a new palette is selected, clients will use the new colors when the session is restarted.

When the value of the dynamicColor resource is True, clients that cannot change colors dynamically (non-Motif applications) allocate different cells in the color map than clients that can change colors dynamically, even if you see the same color.

NOTE: Since all clients can share the same color cells, setting dynamicColor to False reduces the number of colors your desktop consumes.
Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© Hewlett-Packard Development Company, L.P.