WPALETTE-NUM-COLORS (op-code 2)

This operation sets RESULT to the number of distinct solid colors that the host machine can display simultaneously.

WPALETTE-DATA is not used. For monochrome machines, the RESULT value will be 2. For color machines other than Windows, this value will be 16.

For Windows machines, this value will depend on the host hardware and drivers installed. For a standard VGA system, this value will be 16. For Super VGA systems with the proper driver installed, this value can be 256 or higher. If the machine supports more than 32,767 distinct colors, then 32767 will be returned.

For machines with 16 or fewer colors, the standard ACUCOBOL-GT palette represents the entire range of solid (pure) colors. In order to display any other color, that color must be simulated by dithering two or more colors together. Windows allows us to do this, but only for background colors. If you attempt to display a dithered color in the foreground, Windows will automatically substitute the nearest solid color. Dithered background colors can also make the foreground text look ragged, depending on the exact colors used. For this reason, you may want to limit yourself to solid colors. One way to do this is to allow the user to change the palette only when the machine supports 256 colors or more.