COLOR WHERE Attribute

The COLOR WHERE attribute defines a condition to set the foreground color dynamically.

Syntax

COLOR = color-spec [...] WHERE bool-expr
  1. color-spec can be: BLACK, BLUE, CYAN, GREEN, MAGENTA, RED, WHITE, and YELLOW.
  2. color-spec can also be one of: REVERSE, LEFT, BLINK, and UNDERLINE, and it can be combined with a color name (COLOR = RED REVERSE).
  3. bool-expr defines a boolean expression with a restricted syntax. This expression can only reference the current form field item tag.

Usage

The attribute COLOR WHERE defines a conditional color. The color will be applied if the condition is true.

The fglform compiler ignores COLOR=WHITE and COLOR=BLACK: These colors can be specified in the .per file, but will not be written in the .42f file.

A color name like RED, BLUE can be combined with an secondary keyword that must be one of: REVERSE, LEFT, BLINK, and UNDERLINE. The secondary keyword can also be used without a color name.

Note: For backward compatibility, the color can be specified as a number: 0=WHITE, 1=YELLOW, 2=MAGENTA, 3=RED, 4=CYAN, 5=GREEN, 6=BLUE, 7=BLACK. Note that fglform ignores COLOR=0 or COLOR=7: like COLOR=WHITE and COLOR=BLACK.

The condition in COLOR WHERE can only reference the field for which the attribute is set,using its item tag. See Boolean expressions in forms for more details.

Note: With form fields such as EDIT, BUTTONEDIT the color will be applied when leaving the field. The color will not change while editing the value.

Example

EDIT f001 = item.price, COLOR = RED WHERE f001 < 0;