Define Colors

? tab(-10, AG_SETCOLOR); ctype; dash; cnum; dash; r; dash; g; dash; b; chr(127);

? tab(-10, AG_PALETTE); ctype, cnum {,r,g,b}; chr(127);

The function AG_SETCOLOR (15) provides a way to programmatically modify the color that is associated with a specific color palette entry (aka color number). For example, in the standard palette, color 2 is a rather primary intense blue. If you would rather have a more pastel blue, then you can either modify the definition of color 2 on the Display | Colors dialog, or via this command.

Beginning with A-Shell 1115 of June 2008, it is possible to query the RGB definitions of any of the A-Shell palette colors using a variation of the AG_SETCOLOR syntax. In this mode, AG_SETCOLOR is a misnomer; a new symbol, AG_PALETTE has been added to ASHELL.DEF which has the same value as AG_SETCOLOR (15), for anyone bothered by confusion that might be created by using a function called AG_SETCOLOR to query the colors. For this operation, use the second syntax shown above.

Parameters

ctype

1=set fg color, 2=set reduced fg color, 3=set bg color, 4=get fg color, 5=get reduced fg color, 6=get bg color

cnum (same as before)

a single digit (0-7) indicating the color number in the palette that you want to redefine

r,g,b

The R, G, and B values (0-255), used when ctype <= 3.

When ctype >= 4, the command will send back into the keyboard buffer a string formatted as "R,G,B" indicating the RGB values currently defined for the specified palette entry.

Examples

? TAB(-10,15);"1-2-33-44-222";chr(127);

? TAB(-10,15);str(ctype);"-";str(cnum);"-";str(red);"-"; &

str(grn);"-";str(blue);chr(127);

Notes

You can experiment with RGB values on the Settings | Colors dialog by clicking on one of the color buttons and then Define Custom Color.

Although you can use this method to define colors that are more like the standard Windows colors (which are more pastel than the default DOS-like palette colors), for certain logical colors, like the standard gray window background, text font, and white edit window background colors, perhaps a better method would be to use the Associate A-Shell and Windows Colors command or SET.LIT TERMINAL options (see the A-Shell Command Reference) to associate a color palette number with a particular Windows logical color. That way, the user can adjust the color settings logically in the Control Panel and the A-Shell color palette will adjust with it.