[ Previous | Next | Contents | Glossary | Home | Search ]
Motif 2.1 User's Guide



Specifying Colors

Color resources for the window manager include a background color and a foreground color, top and bottom shadow colors, and pixmaps for shading. Names for colors vary from system to system and can also depend on locale. (See your system documentation for a list of valid color names on your system.)

Set the resources for color using the following general format:

Mwm*
 
resource: color

For example, you might have the following specifications in your .Xdefaults file:

Mwm*background: LightBlue
 
Mwm*foreground: Black

Coloring Client Window Frames

The Motif Window Manager provides resources for specifying colors for the window borders of the currently active window and the inactive windows (see Table 5-1).

Table 9. Color Resources and What They Color

Inactive Window and Active Window and
Icon Resources Icon Resources Area Covered
foreground activeForeground Foreground areas (text)
background activeBackground Background areas
topShadowColor activeTopShadowColor Top and left 3-D bevels
bottomShadowColor activeBottomShadowColor Bottom and right 3-D bevels

You should pick contrasting color schemes to make the active window readily distinguishable from its inactive counterparts. For example, if you would like the foreground and background of inactive window frames to be the reverse of the foreground and background of the active window frame, using the colors Wheat and IndianRed, you would specify these resources in your .Xdefaults file:

Mwm*background: IndianRed
 
Mwm*foreground: Wheat
 
Mwm*activeBackground: Wheat
 
Mwm*activeForeground: IndianRed

The default values for mwm color resources are based on the visual type of the screen, such as monochrome or 8-bit pseudocolor, and the values given to related resources. Table 5-2 shows the default values for a color display.

Table 10. Default Values for Appearance on a Color Display

Resource Specification Resource Value
Mwm*activeBackground CadetBlue
Mwm*activeBackgroundPixmap NULL
Mwm*activeBottomShadowPixmap NULL
Mwm*activeTopShadowPixmap NULL
Mwm*background LightGrey
Mwm*backgroundPixmap NULL
Mwm*bottomShadowPixmap NULL
Mwm*topShadowPixmap NULL

Specifying the value of the background resource automatically generates default colors for the top and bottom shadow color resources. A NULL pixmap means that the color is solid, not patterned. The Motif Window Manager uses the following rules for generating default values for color resources:

  1. A top shadow color is generated by proportionally lightening the associated background color.

  2. A bottom shadow color is generated by proportionally darkening the associated background color.

  3. The foreground color is set to black or white, depending on the background color.

    Table 5-3 indicates the default values for the appearance resources on a monochrome display.

    Table 11. Default Values for Appearance on a Monochrome Display

    Resource Specification Resource Value
    Mwm*activeBackground White
    Mwm*activeBackgroundPixmap 50_foreground
    Mwm*activeBottomShadowPixmap foreground
    Mwm*activeTopShadowPixmap 50_foreground
    Mwm*background White
    Mwm*backgroundPixmap 25_foreground
    Mwm*bottomShadowColor Black
    Mwm*bottomShadowPixmap foreground
    Mwm*topShadowColor White
    Mwm*topShadowPixmap 50_foreground
    Mwm*foreground Black

  4. Using Window Frame Pixmaps

    Using a pixmap is a way of creating shades of colors. Pixmaps are drawn in the foreground color. The pixmap is composed of tiles that provide a surface pattern or a visual texture. The concept is analogous to using ceramic tiles to make a pattern or texture on a floor or countertop.

    Generally, the fewer colors a display produces, the more important the pixmap resources become. A pixmap provides a way to mix foreground and background colors into a variety of color patterns. For example, with a monochrome display, you can use the pixmap resource to color window frame elements with shades of gray to achieve a 3-dimensional look.

    There are mwm pixmap resources for creating a pattern for the frame background and bevels of both inactive and active windows (see Table 5-4).

    Table 12. Using Pixmaps for Window Frames

    Use this resource... To pattern these elements...
    backgroundPixmap Background for inactive frames
    bottomShadowPixmap Right and bottom bevels of inactive frames
    topShadowPixmap Left and upper bevels of inactive frames
    activeBackgroundPixmap Background of the active frame
    activeBottomShadowPixmap Right and lower bevels of the active frame
    activeTopShadowPixmap Left and upper bevels of the active frame

    Figure 5-1 illustrates the various bitmaps that are defined in the Motif environment.

    Figure 35. Illustrations of Valid Bitmap Values.




    View figure.

    To obtain the bitmap styles illustrated in the previous figure, use the values listed in Table 5-5.

    Table 13. Valid Pixmap Values

    To pattern an element in this manner... Use this value...
    The foreground color foreground
    The background color background
    A mix of 25% foreground to 75% background 25_foreground
    A mix of 50% foreground to 50% background 50_foreground
    A mix of 75% foreground to 25% background 75_foreground
    In horizontal lines alternating between the foreground and background color horizontal_tile
    In vertical lines alternating between the foreground and background color vertical_tile
    In diagonal lines slanting to the right alternating between the foreground and background color slant_right
    In diagonal lines slanting to the left alternating between the foreground and background color slant_left

    The cleanText resource makes text easier to read on monochrome systems when a backgroundPixmap is specified. This resource controls the display of window manager text in the title area and in the move/resize feedback window. If the value is set to True, the text is drawn with a clear background. Only the background in the area immediately around the text is cleared. If the value is set to False, the text is drawn directly on top of the existing background.

    Coloring Icons

    Icon window frame elements are colored with the same resources as normalized window frame elements. The image part of an icon can be displayed with client-specific colors (see Table 5-6).

    Table 14. Coloring Icon Images

    To color this... Use this resource...
    Icon image background iconImageBackground
    Left and upper 3-D bevels iconImageTopShadowColor
    Right and lower 3-D bevels iconImageBottomShadowColor
    Icon image foreground iconImageForeground

    There are two pixmap resources available for use in shading icon images: iconImageTopShadowPixmap and iconImageBottomShadowPixmap. The default value for iconImageTopShadowPixmap is the icon top shadow pixmap, which is specified by Mwm*icon*topShadowPixmap. The default value for iconImageBottomShadowPixmap is the icon bottom shadow pixmap, which is specified by Mwm*icon*bottomShadowPixmap.

    Resource specifications that color icons can have any of the following formats.

    To color all clients regardless of class, the syntax is

    Mwm*icon*
     
    resource: 
     
    color

    For example, the following specification in a resource file ensures that all icon backgrounds are the same color:

    Mwm*icon*background: CadetBlue

    To color specific classes of client icons, the syntax is

    Mwm*icon*
     
    Clientclass*resource: 
     
    color

    The colors specified with this resource specification take precedence over any other specification of this resource for this class of clients. For example, the following specification ensures that the icon background for xterm clients is the color IndianRed rather than CadetBlue:

    Mwm*icon*Xterm*background: IndianRed

    To color any client with an unknown class, the syntax is

    Mwm*icon*default*
     
    resource: 
     
    color

    Coloring Menus

    The color resources for the mwm Window Menu and Root Menu are the same as those for inactive windows and icons (see Table 5-1). Menus that appear in application programs are not affected by the values set for these resources. Default menu colors are determined by the type of display.

    Resource specifications that color Menus can have any the following formats.

    To color all clients regardless of class, the syntax is

    Mwm*menu*
     
    resource: 
     
    color

    For example, the following specification in a resource file ensures that all Menu backgrounds are the same color:

    Mwm*menu*background: CadetBlue

    To color specific classes of clients, the syntax is

    Mwm*menu*
     
    Clientclass*resource: 
     
    color

    The colors specified with this resource specification take precedence over any other specification for this resource for this class of clients.

    To color any client with an unknown class, the syntax is

    Mwm*menu*default*
     
    resource: 
     
    color

    You can also specify a color for a Menu with a specific name using the following syntax:

    Mwm*menu*
     
    menuname*resource: 
     
    value

    For example, the following specification in a resource file sets the color of my_menu:

    Mwm*menu*my_menu*background: SlateBlue

    Coloring Mattes

    A matte is a 3-dimensional border between the client's window area and the window frame. A matte can give an individual client, or class of clients, a distinct appearance. To configure a matte, you need to give the matteWidth resource a positive value. The matteWidth resource defines the width of the matte between the client and the window frame. The width is specified in pixels. The default value of 0 (zero) disables the matte.

    For example, to specify a matte of 10 pixels around all xload windows, use the following specification in your .Xdefaults file:

    Mwm*XLoad*matteWidth: 10

    Matte resources use the same wording as window frame resources, but begin with the term matte (see Table 5-7).

    Table 15. Matte Resources and What They Color

    Matte Resource Area Colored
    matteBackground Background areas
    matteTopShadowColor Top and left 3-D bevels
    matteBottomShadowColor Bottom and right 3-D bevels
    matteForeground Foreground areas

    As with frame colors, the fewer colors a display can produce, the more value there is in using pixmap resources for mattes (see Table 5-8).

    Table 16. Resources for Using Pixmaps with Mattes

    Use this resource... To pattern these elements...
    matteBottomShadowPixmap Right and lower bevels of mattes
    matteTopShadowPixmap Left and upper bevels of mattes

    Resource specifications for coloring mattes can have any of the following formats.

    To matte all clients regardless of class, the syntax is

    Mwm*
     
    matteResource: 
     
    value

    For example, to create a 10-pixel wide yellow matte for every client window, use the following specification in a resource file:

    Mwm*matteWidth: 10
     
    Mwm*matteBackground: Yellow

    To matte specific classes of clients, the syntax is

    Mwm*
     
    Clientclass.matteResource: 
     
    value

    To matte any client of an unknown class, the syntax is

    Mwm*default*
     
    matteResource: 
     
    value

    [ Previous | Next | Contents | Glossary | Home | Search ]