Integrating applications into the Desktop

Supporting the Desktop color selector

SCO OpenServer system users can use the Color utility (located in the Preferences editor) to simultaneously modify the coloring of all Desktop utilities, window frames, menus, and backgrounds. If you specify your color resources through the color API, users will be able to personalize your application's colors along with those of the rest of the Desktop.

The color API is based on palettes. A palette is a coordinated set of eight colors, defined by the current values of the eight color name variables. Each variable defines the color for several graphical objects.

Color name variables

Variable Typically used for
scoBackground window frames, window backgrounds, scrollbar troughs
scoAltBackground Desktop background, second background color
scoForeground text
scoTopShadow top shadows of frames, buttons and other objects
scoActiveBackground frame of active window
scoActiveForeground text in frame of active window
scoActiveTopShadow top shadows in active window
scoHighlight text or objects that need special emphasis, pressed buttons

The active window is the window with the input focus. The scoActiveBackground, scoActiveForeground, and scoActiveTopShadow variables are used to distinguish the active window from other windows. In the supplied palettes, scoTopShadow is lighter than scoBackground, and scoBackground contrasts with scoForeground. Bottom shadows are always black. When using the color name variables for interface elements other than those listed, consider the relationships of the colors and how that might affect contrast or legibility.

Color palettes are automatically mapped to grayscale displays. Because this might not always yield optimal results, several grayscale palettes are provided. A default monochrome palette mapping is used on monochrome displays.

For more information about the Color utility, see the scocolor(XC) manual page and the Graphical Environment Guide.

To support the Desktop color selector:

  1. Use color name variables to define color resources.

    In your app-defaults file, define color resources with the color name variables listed in ``Color name variables''. The system will set the variables to the corresponding color definitions from the currently selected palette.

    For example, an application that displays a calendar might include the following resource definitions in its app-defaults file:

       *datebox.back.background:         scoAltBackground
       *current.week.background:         scoActiveForeground
       *meeting.alarm.background:        scoHighlight
    Name your app-defaults file with your application's class name, and install it in the /usr/lib/X11/app-defaults directory. For more about app-defaults files, see the Graphical Environment Guide.

  2. Link your application with the SCO OpenServer Development System.

    Color name variables used by applications that have not been linked with this release of the SCO OpenServer system will be mapped to the default palette, Winter Blue. When a user changes Desktop colors by selecting a new palette with the Color utility, your application's colors will continue to be defined by the Winter Blue palette.

  3. Include the default color resources in your app-defaults file.

    To ensure that your application will always display, even if it is run without the session manager, copy into your app-defaults file the default color resource definitions from /usr/lib/X11/sco/startup/Colors (listed below). Place these definitions before any overriding definitions of your own.

       *Background:                    scoBackground
       *Foreground:                    scoForeground
       *topShadowColor:                scoTopShadow
       *bottomShadowColor:             Black
       *activeBackground:              scoActiveBackground
       *activeForeground:              scoActiveForeground
       *activeTopShadowColor:          scoActiveTopShadow
       *activeBottomShadowColor:       Black
       *troughColor:                   scoBackground
       *armColor:                      scoHighlight
       *highlightColor:                scoForeground
       *selectColor:                   scoForeground
       *borderColor:                   Black

Next topic: Defining display-dependent colors
Previous topic: Display attribute symbols

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