Main Board > FAQs

How to change color used when printing 'SB' on Windows


Over the last few years Windows has changed the brightness of the gray color it uses on buttons and windows.  By default, the Windows gray colors are used by PxPlus to define the Light and Dark gray colors so that windows and controls created in PxPlus match the colors used by Windows.  These gray colors are also used by the system when displaying Black or White text with the 'SB' (Set Background) mnemonic enabled -- Dark gray for Black text, Light gray for White text.

Unfortunately in recent years these colors have become paler than they used to be making Light gray (#15) almost pure white which causes a problem when displaying white text with the 'SB' mnemonic.  This is especially problematic if you are running text mode applications and have changed the display to use a black background with white text.

There are two solutions to address this situation:

* The easiest solution is to simply change the Light Gray to be a bit darker.  This can be done using the following command

SETDEV (0) SET "Color15" TO "#A0A0A0"

This sets the color of Light Gray (color index 15) to a slightly darker color (Red, Green and Blue all set at 160/255).  Unfortunately this solution does have its drawbacks as it changes Light Gray everywhere so that PxPlus windows with a light gray backgrounds will no longer match the Windows color scheme.

* The alternate solution is to define a new color index to use for White text with 'SB'.  PxPlus has 15 standard colors (0-15) but for this you be required to define a new color, such as Color16, then change the Video Palette index table for White with the SB enabled to use this color.  The Video Palette index table consists or a series of six 8 byte color index values as bytes which identify the actual color index to use.  Each 8-byte entry has a 1-byte color index for the colors Black, Red, Green, Yellow, Blue, Magenta, Cyan and White in that order.

The second 8 byte table defines the colors to use when 'SB' is active.  Since White is color number 8 you need to change byte 16, second table eighth byte, to CHR(16).  For more information on the Video Palette please see this web page

Here is the code you will need to do this:

SETDEV (0) SET "Color16" TO "#A0A0A0"
X$(16,1) = CHR(16)

If running WindX setting video palette needs to be done on the workstation and not on the server, thus the first solution is often much easier to implement in this environment.
Once the colors have been changed you need for Windows to refresh your page otherwise you will only get the new color on areas on the screen that are being updated.
NOTE: This FAQ is for use with Windows and not normal terminals which will use the escape sequence in the *dev driver programs.


[0] Message Index

Go to full version