? tab(-10, AG_SETCOLOR); ctype, cnum, r, g, b; chr(127); ? Tab(-10,x) Syntax Notes
? tab(-10, AG_PALETTE); ctype, cnum; chr(127);
input "",r,g,b
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.
You may also query the RGB definitions of any of the A-Shell palette colors using the second syntax above. AG_PALETTE and AG_SETCOLOR have the same value, 15, but AG_PALETTE seems like less of a misnomer when querying rather than setting.
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
a single digit (0-7) indicating the number of the palette entry you want to query or set
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
! set fg color #2 to RGB(33,44,222)
? TAB(-10,AG_SETCOLOR);"1,2,33,44,222";chr(127);
! query bg color 7
? TAB(-10, AG_PALETTE);"6,7"; chr(127);
INPUT "", R, G, B
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 window background (gray), text font (black), and edit window background (white), perhaps a better method would be to use the Associate A-Shell and Windows Colors command or SET.LIT TERMINAL options 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.
History
2008 June, A-Shell 5.1.1115: Add the ability to query the current color definition. Add support for the more standard comma delimiters, although you may continue to use dashes instead.