Topic: APLX Help : System Classes : Properties : color
[ Previous | Next | Contents | Index | APL Home ]

www.microapl.co.uk

The 'color' property


(Alternative name: colour)

Numeric vector - see description

Valid for: All displayable objects, Printer and Series

The color (or, if you prefer, colour) property determines the foreground and optionally the background color for an object. Colors are set by specifying the amount of Red, Green and Blue in the range 0 to 255. (Because of limitations in display hardware, the color displayed will not be exact but will be the closest available from the current palette.)

Colors can be specified in one of two ways. In the first way, you specify a vector of three integers (Red, Green and Blue), so that for example 255 0 0 is pure red and 255 255 255 is white. In the second way, you specify a single integer which encodes the three values in base 256 as 256 Blue Green Red. In addition, two special values are recognised; ¯1 means use the parent's foreground or background color as appropriate, and ¯2 means use the default color for that object (usually black for foreground and white for background). The default value for most objects is ¯1 ¯1.

You can specify any of the following lengths for the value of the color property:

      1  The foreground color encoded as a single integer.
      2  The foreground and background colors both encoded as
           single integers
      3  The foreground color as R G B values separately
      6  Both foreground and background as R G B separately.

Referencing this property always returns a two-element vector of the encoded foreground and background colors.

For a Grid object, the foreground color you set determines the default color of the text shown in the Grid (you can change this for individual cells using the colortext cell property). The background color is used as the background for the data part of the Grid (you can change this for individual cells using the colorback cell property).

For a Series object, the color property determines the color used to display that series on a chart. Only the first (foreground) color applies. By default, this is chosen automatically when the series is created, but you can change it if you want to specify a particular color for that series. It is ignored if the monochrome property of the parent Chart object is 1.

Note: Colors for controls like buttons should be used with discretion. In general, User Interface Guidelines advise against using non-default colors for controls, and where these are used they should normally not be bright hues which attract too much attention and detract from the typical look of the screen. In addition, some controls will display in an ugly way if non-default colors are used. This is particularly true of background colors, which generally paint the enclosing rectangle of the object. A few controls will override the color which you set - for example, a color icon displays in its own colors, ignoring the foreground color you specify except for drawing the frame (if any) around the icon, and the color you set is ignored for scroll bars and pop-up menus (except for the frame, if any).


Topic: APLX Help : System Classes : Properties : color
[ Previous | Next | Contents | Index | APL Home ]