Please enable JavaScript to view this site.

A-Shell Reference

Navigation: Tab Functions > ATE Functions

AG_SETCOLOR, AG_PALETTE

Scroll Prev Top Next More

Reviewed and revised December 2023

tab(-10, AG_SETCOLOR); ctype, cnum, r, g, b; chr(127);     Tab(-10,x) Syntax Notes

AG_SETCOLOR (15) (aka AG_PALETTE) provides a way to query and/or modify the RGB value associated with a specific color palette index (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. In this operation, perhaps AG_SETCOLOR may seem like a better name.

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 Red, Green, and Blue values (0-255).  Applicable only when ctype <= 3.

Response

For ctype <= 3 (i.e. when setting a color), there is no response.  For ctype >= 4, response consists of:

r, g, b <CR>

where r, g, and b are the red, green and blue values for the specified palette and cnum.

 

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.