Please enable JavaScript to view this site.

ASQL Reference

Navigation: » No topics above this level «

Define the Color Palette

Scroll Prev Top Next More

Reviewed July 2020

Launch your application, then exit back to a dot prompt and use the SET TERM command to see what your standard foreground and background colors are:

.SET TERM

Current terminal settings for TSKAAA are:

 

Terminal driver:  PCTDVG

Baud rate:        19200

Terminal width:   80

Terminal height:  24

Foreground color: 6

Background color: 0

Beveling:         Auto

Sys bg color      None

Win bg color      None

Win text color    None

In the above display, the foreground color is 6 (default is green) and the background is 0 (default is black). (If your screen is not green on black, then you have already redefined the meaning of the color palette entries for background 0 and/or foreground 6.) If your application never changes its basic color scheme, then you have two options for doing so yourself. One is for you to initialize the foreground and background color settings when you start the app, either via a CMD file with SET TERM FCOLOR and SET TERM BCOLOR commands, or preferably by adjusting the default or a custom CLR.INI file. The other method is to redefine the palette so that that the default palette numbers foreground 6 and background 0 refer to something other than green on black. See the Colors Menu for details on color customization.

Changing a monochrome green-on-black application to some other pair of colors is not a major improvement, and is not specifically related to GUI, but if you use the Custom Color option on the Color dialog to define some subtle or pastel colors rather than the primary DOS-style colors of the default palette can bring a psychological improvement. The following two shots give an idea of this. First, we have a traditional DOS-like color scheme:

ashref_img65

Then we improve things slightly by moving to a more pastel palette:

ashref_img66

If your intent is to move towards a Windows-like look, then you will have to start getting use to the Windows gray dialog background color. The particular shade of gray seems to change which each version of Windows and with the desktop theme, so it isn’t practical to try to define it manually. Instead, decide which of the 8 background palette numbers you want to dedicate to gray. (0 is probably a good bet, since that is the most common background number to use. Or, if you want to preserve your options, you might use 7, which is otherwise the least commonly used color number.) To define the palette number n as matching the current Windows gray background color, use one of the following commands:

.SET TERM SYSBCOLOR n

xcall MIAMEX,MX_SYSBCLR,1,n

PRINT TAB(-10,AG_SYSBCLR);n;chr(127);

While you’re redefining your background color to match Windows, you might as well do the same with your standard foreground (text) color and editing window background colors. The standard text color in Windows is black, and the standard editing window background is white. Since these coincide with existing palette entries (although the particular shades of black and white may differ), it seems reasonable to link those palette numbers to the Windows color definitions of black text and white editing windows. Again you have your choice of the following methods:

.SET TERM WINBCOLOR 1       ; (define fg 1 to match windows edit bg)

.SET TERM WINTXTCLR 0       ; (define bg 0 to match windows text clr)

or

FGTXT = 1    ! FG color # to use for text

BGSYS = 0    ! BG color # to use for main window

BGEDT = 1    ! BG color # to use for editing windows

xcall MIAMEX,MX_SYSBCLR,1,BGSYS,BGEDT,FGTXT

or

PRINT TAB(-10,AG_SYSBCLR);BGSYS;",";BGEDT;",";FGTXT;chr(127);

After setting the above colors, you will probably want to save them in your current settings file (use menu File...Save), but note that this only saves the current Windows definitions for those colors. If the Windows colors have been changed by the next time you launch A-Shell, they will again be out of sync. So it is best to incorporate the above color initialization logic into your application startup so it is always current.