Using standard COBOL values
The first way, provided for compatibility reasons, uses up to sixteen values. These values range from 1 to 16 when foreground and background colors are combined, while they range from 0 to 15 when foreground and background colors are specified separately.
Combining foreground color and background color
Values 1 to 8 are base colors, 9 to 16 are their brighter version. The file "iscobol.def" contains the color definitions. They are divided into groups, and can be combined:
ForegroundColor
78 black value 1.
78 blue value 2.
78 green value 3.
78 cyan value 4.
78 red value 5.
78 magenta value 6.
78 brown value 7.
78 white value 8.
78 dark-gray value 9.
78 bright-blue value 10.
78 bright-green value 11.
78 bright-cyan value 12.
78 bright-red value 13.
78 bright-magenta value 14.
78 yellow value 15.
78  bright-white value 16.
ForegroundBrightness
78 frgrnd-low value 2048.
78  frgrnd-high value 4096.
BackgroundColor
78 bckgrnd-black value 32.
78 bckgrnd-blue value 64.
78 bckgrnd-green value 96.
78 bckgrnd-cyan value 128.
78 bckgrnd-red value 160.
78 bckgrnd-magenta value 192.
78 bckgrnd-brown value 224.
78 bckgrnd-white value 256.
78 bckgrnd-dark-gray value 288.
78 bckgrnd-bright-blue value 320.
78 bckgrnd-bright-green value 352.
78 bckgrnd-bright-cyan value 384.
78 bckgrnd-bright-red value 416.
78 bckgrnd-bright-magenta value 448.
78 bckgrnd-yellow value 480.
78 bckgrnd-bright-white value 512.
BackgroundBrightness
78 bckgrnd-low value 65536.
78 bckgrnd-high value 131072.
GenericAttribute
78 color-reverse value 1024.
78 color-underline value 8192.
78 color-blink value 16384.
78 color-protected value 32768.
The color value is computed as follows:
Zero
 
[ + ForegroundColor]
 
[ + ForegroundBrightness]
 
[ + BackgroundColor]
 
[ + BackgroundBrightness]
 
[ + GenericAttribute ] ...
When the REVERSE-VIDEO phrase is specified, background and foreground colors are swapped.
When the SAME phrase is specified, the whole screen item for which it is specified is displayed with the same colors and attributes of the screen position occupied by its first character.
This kind of color value is suitable for
the COLOR clause of the DISPLAY statement,
the Color property of each control,
the following special properties:
Specifying foreground color and background color separately
When an color value is used with a property that defines either the foreground color or the background color, the value can be only 0 to 15 and the corresponding color is applied to foreground or background. The table below shows the possible values for BACKGROUND-COLOR and FOREGROUND-COLOR properties.
0 Black
1 Blue
2 Green
3 Cyan
4 Red
5 Magenta
6 Brown
7 White
8 Dark Gray
9 Bright Blue
10 Bright Green
11 Bright Cyan
12 Bright Red
13 Bright Magenta
14 Yellow
15 Bright White
Brightness can be also affected by the following clauses:
BACKGROUND-HIGH
BACKGROUND-LOW
BACKGROUND-STANDARD
HIGHLIGHT
LOWLIGHT
STANDARD
For example, a "BACKGROUND-COLOR 4 BACKGROUND-HIGH" is equivalent to "BACKGROUND-COLOR 12". Both syntaxes shows an high intensity red background.
When the REVERSE-VIDEO phrase is specified, background and foreground colors are swapped.
When the SAME phrase is specified, the whole screen item for which it is specified is displayed with the same colors and attributes of the screen position occupied by its first character.
This kind of color value is suitable for
the BACKGROUND-COLOR and FOREGROUND-COLOR clauses of the DISPLAY statement,
the Background-Color and Foreground-Color properties of each control,
the following special properties:
Example
The snippet below shows how the same color value ("2" in this case) specifies different colors depending on the property it refers to:
       SCREEN SECTION.
       01 screen-1.
          03 label title "green"
             line 2col 2size 10 cells
             foreground-color 2 |this label has green foreground color
             .
          03 label title "blue"
             line 4col 2size 10 cells
             color 2 | this label has blue foreground color
             .