Adding Color

ACUCOBOL-GT allows you to add color, without reprogramming, to programs that were originally written for black-and-white terminals. You accomplish this by assigning color values to the runtime configuration variable COLOR-MAP . The COLOR-MAP keyword is followed by one of the following single attributes:

High, Low, Reverse, Blink, Underline, Default, or Exit;

or by one of the following hyphenated combinations of attributes:

High-Reverse Low-Reverse
High-Blink Low-Blink
High-Reverse-Blink Low-Reverse-Blink
High-Underline Low-Underline
High-Reverse-Underline    Low-Reverse-Underline   
Reverse-Blink Reverse-Underline

The single attribute, or attribute combination, is then followed by an equals sign and one of the following color names:

Black, Blue, Green, Cyan, Red, Magenta, Brown, White

The named color becomes the foreground color that is displayed whenever the corresponding attribute is used in a DISPLAY statement. For example, if you want fields that are displayed as low-intensity to appear green, use the following configuration file entry:

COLOR-MAP   Low=Green

You can also assign a background color value. It follows the foreground color and is separated from it by a comma. For example, to assign white characters on a blue background for high-intensity fields, you would use the following:

COLOR-MAP   High=White,Blue
Note: No spaces should appear within the assignment.

You may specify more than one attribute in a single COLOR-MAP line. Simply separate the attributes from each other by spaces. For example:

COLOR-MAP  High=Green  Low=Red  Reverse=Blue

The following points should be noted:

  1. The named video attribute is still used by the ACCEPT or DISPLAY. For example, Reverse=Blue will result in a reverse-video blue field while High=Brown will use high-intensity brown (on some terminals, specifying High=Brown will cause yellow to be generated by any DISPLAY HIGH phrase).
  2. If a particular ACCEPT or DISPLAY statement has a COLOR phrase, that phrase will be used instead of the COLOR-MAP attributes in the runtime configuration file. Note, however, that the COLOR-MAP will apply to fields that use the FCOLOR or BCOLOR options of the CONTROL phrase.
  3. The attributes HIGH, LOW, and REVERSE are treated in a special manner. If a statement uses more than one of the three, then the attribute/color used will be in this order of preference:
    1. REVERSE
    2. HIGH
    3. LOW

    For example, a DISPLAY statement specifying both REVERSE and HIGH will use the color associated with REVERSE.

    Also, any one of these settings is used for all applicable cases, except where specifically overridden by another setting. For example:

    COLOR-MAP   REVERSE=Red  LOW-REVERSE=Blue

    will use red for all statements that specify REVERSE except for statements that explicitly specify REVERSE,LOW.

    In all other cases, the configuration variable must exactly match the COBOL statement. For example, a configuration file attribute HIGH-REVERSE would not apply to a program statement that included HIGH,REVERSE,UNDERLINE.

    Note that compiler options -Vl and -Vh cause LOW and HIGH respectively to be implied for program statements; create your COLOR-MAP as though LOW or HIGH were explicitly coded in the program.

  4. The DEFAULT attribute works a little differently. It is used to assign the initial default colors for the screen. Its effect is the same as having a DISPLAY WINDOW COLOR statement as the first statement of your program.
  5. The EXIT attribute determines which colors ACUCOBOL-GT will set when it terminates. These colors are also set when a call is made to the SYSTEM library routine. On some machines these colors are immediately changed by the operating system prompt and thus have no effect.
  6. You can assign values to the color map from within a COBOL program through use of the SET ENVIRONMENT verb. You can turn off the color map with the following statement:
    SET  ENVIRONMENT  "COLOR-MAP"  TO  "OFF"
  7. Note that on a XENIX console, if you use the XENIX command setcolor to establish a high-intensity background color, you may get unexpected results from ACUCOBOL-GT. This is because the implementation of high-intensity background colors causes XENIX to treat the blink bit as a background intensity bit instead. In addition, because ACUCOBOL-GT can select only 8 background colors, all of the background colors used will be high-intensity, including black (which shows up as a light gray).

    For these reasons, we recommend that you avoid using a high-intensity background color if you are using the XENIX console. As an alternative, you may create a shell script to run ACUCOBOL-GT. This script could set a low-intensity background color, run ACUCOBOL-GT, and then reset the desired high-intensity background color.