Xbasic

Alpha5::ColorDefinition Class

Description

The ColorDefinition object provides more flexible methods for defining and using colors.

dim c1 as colordefinition

c1.name = "green"
? c1.RGB_Value

= 65280
? c1.HTML_Name

= "Lime"
? c1.Hue
= 120

? c1.Luminance
= 50

? c1.Saturation
= 100

? c1.Red
= 0

? c1.Blue
= 0

? c1.Green
= 255

dim c2 as colordefinition
c2.red = 255
? c2.name
= "Red"

In all places in Alpha Anywhere where you can set a color by name, you can now use standard HTML colors and System colors by using the 'html-' or 'system-' prefix. For example:

ui_dlg_box("Test",<<%dlg%
{background=html-lavender}
Name [.20name];
%dlg%)

ui_dlg_box("Test",<<%dlg%
{background=system-inactivecaption}
Name [.20name];
%dlg%)

Properties

BlueCharacter

The "blue" value of the color, a value between 0 and 255.

GreenCharacter

The "green' value of the color, a value between 0 and 255.

HTML_NameCharacter

If the color is a standard HTML color, returns the HTML name.

HueCharacter

The hue of a color, a value between 0 and 255.

LuminanceCharacter

The luminance of a color, a value between 0 and 255.

NameCharacter

The name of a color.

RedCharacter

The "red" value of the color, a value between 0 and 255.

RGB_ValueCharacter

The RGB value of a color.

SaturationCharacter

The saturation of a color, a value between 0 and 255.

Methods

Blend Method

Mix two colors together, optional ratio > 0.0, ratio < 1.0 (.5 if not specified).

Enumerate Method

Enumerate named color - optional flags 'H'tml colors 'S'ystem colors , 'A'lpha Five colors, 'F'ullnames .

GetHueColor Method

Get the saturated HUE color.

HTMLNameToRGB Method

Given a html color name, return an RGB value.

NameToRGB Method

Given a color name, return an RGB value.

See Also