Uniface Index Colors

Uniface index colors are combinations of foreground an background colors that are identified by a color code, a number from 0 to 63.

Note:  Use index colors only if you are developing an application with a character-based user interface, or if you are maintaining an application that was developed with a previous version of Uniface. Otherwise, it is preferable to use the Background Color and Foreground Color properties of components, widgets, and HTML controls.

Uniface index colors have the following limitations:

  • Transparent colors are not supported. An object cannot have a transparent foreground or background color, even if color codes are assigned to transparent colors.
  • Color cannot be modified after the component or widget is loaded.

Applying Index Colors

To apply a Uniface color to an object in a component, specify the index color in the Color property. For more information, see Index Color .

To change index colors of fields and entity occurrences dynamically, you can use the curoccvideo and fieldvideo ProcScript statements. For more information, see curoccvideo and fieldvideo.

To set the default index color for the active field, you can set the assignment setting $ACTIVE_FIELD. For more information, see $ACTIVE_FIELD.

Caution: Avoid combining Uniface index colors with the Foreground and Background properties.

For example, if you have set the Foreground and Background colors, you should not use curoccvideo or fieldvideo because these statements set an index color. When the item loses focus, the color is restored to the default index color, not to the Foreground and Background colors.

Index Color Definitions

Uniface provides default color definitions for four color sets—Normal, Bright, Blink, and Bright & Blink. A color set consists of 8 foreground color definitions and 8 background color definitions. Each definition is identified by a number, as shown in the following table:

Default Uniface Color Codes
Color Foreground Color Background Color
System default 0 0
Blue 8 1
Green 16 2
Cyan 24 3
Red 32 4
Purple 40 5
Yellow 48 6
White - 7
Black 56 -

The sum of the foreground and background numbers is the ColorCode.


The Bright and Blink video attributes determine the color set used for an object. Other video attributes (Underline and Border) have no effect.

For example, in the default Normal color set, foreground number 8 is blue, and background color 7 is white. Added together, these create the color code 15, which is blue on white. In the Blink color set (applicable only for a character-based user interface), the number 8 is assigned to grey and the number 7 is blue, so the color code 15 would result in grey on blue.

Index colors

On a monochrome display, selecting 4 through 7 as a background color number causes the display to appear in inverse.

If you select the same color for foreground and background, the system defaults are used. Thus, COL=9, COL=18, COL=27, COL=36, COL=45, COL=54, and COL=63 all act as if color code 0 has been selected.

The color sets are defined in the [background] and [foreground] sections of the usys.ini file. For more information, see [background] and [foreground].

Modifying Color Sets

The default color sets can be changed. However, any object for which a color has been defined changes color according to the new colors assigned to that color code.

To view the default color sets, click the Uniface icon in the title bar of the application, choose Settings, and then go to the Colors tab.

To change a color, double-click the color and choose the new default color in the resulting dialog box.

It is also possible to set the color code to No, in which case the object uses the Microsoft Windows color.

Color Code 0 and Color Code No

Uniface color code No instructs Uniface to use the operating system colors rather than Uniface colors. For most objects, it also interprets color code 0 as color code No.

However, for forms and labels, 0 is interpreted as the Uniface color 0, so Uniface provides the following settings to ensure that Uniface applications use Windows system colors for all objects in the user interface.

Initialization Setting Description
SystemColors on—all widgets use the underlying Microsoft Windows color scheme, unless the widget has an explicit color.

off—forms and labels with Uniface color 0 use Uniface color 0; all other objects with color 0 use the Microsoft Windows color scheme.

ColorZero on—forms and labels with Uniface color 0 use the underlying Microsoft Windows color scheme, ignoring the Uniface color setting.

off—forms and labels apply Uniface color 0

If these settings are turned off, this can cause a mismatch in color, as shown in the following illustration, where the Color property set to 0 for the label and all fields. Because the label applies Uniface color 0, it does not match.

Mismatched Colors When Color=0

Mismatched colors when color=0