The Color Class

The Color class provides methods for specifying the color of an object.

Syntax

Color

Member Objects: Static Member Variables

These member variables do not require an object. They are prefixed by the Color class name.

Table 1. Member Objects (Static Member Variables)
Name Description
BLACK Specifies a Color object having the color BLACK
BLUE Specifies a Color object having the color BLUE
CYAN Specifies a Color object having the color CYAN
DARK_GRAY Specifies a Color object having the color DARK_GRAY
GRAY Specifies a Color object having the color GRAY
GREEN Specifies a Color object having the color GREEN
LIGHT_GRAY Specifies a Color object having the color LIGHT_GRAY
MAGENTA Specifies a Color object having the color MAGENTA
ORANGE Specifies a Color object having the color ORANGE
PINK Specifies a Color object having the color PINK
RED Specifies a Color object having the color RED
WHITE Specifies a Color object having the color WHITE
YELLOW Specifies a Color object having the color YELLOW

Usage

With RTL classes, it is not possible to create and subclass objects. The new keyword is not supported.

The default color for a report item, such as a LayoutNode, is black. You can change the color of the item by entering a value for the color or bgColor property in the Properties View. These properties are of type Color; Instead of selecting a color from the Edit Expressions color palette, you can use the members of this class in an expression that returns a Color object.

Member Objects Usage

These objects are static member variables that do not require an object instance. The variables are prefixed with the Color class name and the '.' character.

Example:
Color.RED

Class Methods

Class methods do not require a Color object instance. When you invoke a class method, it is prefixed with the Color class name and the '.' character.

Table 2. Class Methods (Static Member Methods)
Name Description
fromHSBA(h Numeric, s Numeric, b Numeric)
Returns a Color object based on the specified values of hue, saturation, and brightness for the HSB color model.
fromHSBA(h Numeric, s Numeric, b Numeric, a Numeric)
Returns a Color object based on the specified values of hue, saturation, brightness, and alpha for the HSB color model.
fromRGBA(r Numeric, g Numeric, b Numeric)
Returns an opaque sRGB Color object with the specified red, green, and blue values.
fromRGBA(r Numeric, g Numeric, b Numeric, a Numeric)
Returns an sRGB Color object with the specified red, green, blue, and alpha values.

Object Methods

Color object methods are called on a Color object instance. Object methods require an object reference. When you invoke the method, it is prefixed with the object instance name and the "." character.

Table 3. Object Methods
Name Description
brighter()
Brightens the Color object.

Creates a brighter version of the Color object by applying an arbitrary scale factor to each of the RGB components. Invoking a series of invocations of the darker and brighter methods might give an inconsistent result because of rounding errors.

darker()
Darkens the Color object.

Creates a darker version of the Color object by applying an arbitrary scale factor to each of the RGB components. Invoking a series of invocations of the darker and brighter methods might give an inconsistent result because of rounding errors.

getAlpha()
Returns the Numeric alpha component in the range 0-255.
getBrightness()
Returns the Numeric brightness value of the value in the HSB color model
getBlue()
Returns the Numeric blue component in the range 0-255 in the default sRGB space.
getGreen()
Returns the Numeric green component in the range 0-255 in the default sRGB space.
getRGBA()

Returns the Numeric RGB value representing the color in the default sRGB color model. Bits 24-31 are alpha, 16-23 are red, 8-15 are green, and 0-7 are blue.

getHue()
Returns the hue value of the value in the HSB color model.
getRed()
Returns the Numeric red component in the range 0-255 in the default sRGB space.
getSaturation()
Returns the saturation value of the value in the HSB color model.
toString()
Return a string representation in the form "#argb".

Example - Color Object Method

Color.RED.darker()