3.2.1 Color Property
Color properties (foreground/text and background/fill) are frequently used to highlight a text or textbox element. The simplest way to specify a color property is to assign a string containing one of the constants from the java.awt.Color class: black, blue, cyan, darkGray, gray, green, lightGray, magenta, orange, pink, red, white, and yellow.
foreground = 'red';
Since color is a Java type, the class name must be fully qualified.
You can also specify a color as java.awt.Color object, an integer (e.g., hexadecimal) representing the RGB value of a color, an array of RGB values, or a JSON object.
foreground = java.awt.Color.red;
background = 0xFF00FF; // RRGGBB
foreground = [255, 255, 0];
foreground = {r:255,g:255,b:0};
Alternatively, you can create a color object by calling the constructor with the the 'new' operator.
foreground = new java.awt.Color(0.5, 1, 0);
Note that the parameters to the color constructor have type float. Because JavaScript treats all numbers as float by default, you have to explicitly convert them to integer if you want to specify the RGB values in the range of 0-255. The default float parameters pass the RGB value in the range of 0-1, where 1 is equivalent to 255 in the integer version.
| << 3.2 Common Element Properties | © 1996-2013 InetSoft Technology Corporation (v11.4) | 3.2.2 Font Property >> |