XTREE enhancement: new Advanced Coldef Option RGBfgbg provides capability to specify foreground and background colors for individual cells. The setup is similar to that for the cformat code B, whereby the first space of the cell is reserved for an optional code that references an RGB color, except that in this case, the color reference is to a pair of RGB colors (foreground and background).
There are three parts to configuring this capability:
• | Add the cformat code "BC" to the column definition, which signifies that the first byte of the column data is reserved for the color index character (A-Z,a-z) or blank to indicate the standard/default color. Note that although "BC" may be seen as a sort of combination of the individual B and C codes, the interpretation of the combined "BC" code completely replaces their individual meanings. |
• | Define a set of RGB values associated with index characters using RGBfg and/or RGBbg clauses, in the usual way, e.g. RGBbg=50,100,150,A. These colors and their associated index codes may or may not be used for other purposes in the tree, but they are needed in order to define the color pairs used by the "BC" columns. |
• | Specify one or more RGBfgbg clauses which associate a new color index code in the same A-Z,a-z range, with a pair of individual color index codes: |
RGBfgbg=fgbg(fg,bg);fgbg(fg,bg)...
e.g. |
RGBfgbg=A(A,B);f(Z,q);r(M,);P(,p);Z(,)
Each RGBfgbg clause can contain one or more fgbg(fg,bg) tuplets separated by semicolons. Each tuplet starts with a mandatory index character (A-Z,a-z) which will be used to refer to the combined fg/bg color pair. The fg and bg codes representing the foreground and background colors are each optional (although the comma is mandatory); if omitted, that part of the color pair reverts to the default.
Note that although the individual RGB index characters and the combined FG/BG index characters both occupy the same range (A-Z,a-z), they refer to different tables of colors. So you can have 52 individual colors associated with an index character, and in addition, up to 52 combined pairs associated with an index character. For a given index character, XTREE knows whether to refer to the individual or combined color table by the context, e.g. if the column definition contains "BC", then it will refer to the combined color table, whereas if it contains only "B" or "C" then it would refer to the individual table. However, if you have fewer than 26 of each type of color index you may want to use upper case for one type and lower for the other, just to reduce confusion.
For example:
coldef += "0~0~x~H~RGBbg=50,100,150,A~RGBbg=75,125,175,B~~"
coldef += "0~0~x~H~RGBfgbg=A(A,B);B(B,A);C(A,);D(,B);z(,)~~"
The first line defines two individual RGB colors, indexed as A and B. The second line defines five fg/bg pairs, indexed as A, B, C, D, and z. (We only partially followed the advice just given to separate the two types of indices by upper and lower case.)
The combined fg/bg index character A refers to foreground color A (50,100,150) and background color B (75,125,175). Combined fg/bg index character B refers to the same pair, but with foreground and background reversed. The combined fg/bg index character C refers to the A foreground color with the default background color. D refers to the default foreground color with background color B. And z is equivalent to " " since both the foreground and background colors of the pair are omitted, i.e. set to default.)
A new sample program XTRAFGBG in EXLIB [908,21] has been posted to illustrate this feature.