Color

EasyX uses 24bit True color and does not support palette mode.

The method that represents the color

1. Represents a color with a predefined constant

Constant		Value		Color description
--------		--------	--------
BLACK			0			Black
BLUE			0xAA0000	Blue
GREEN			0x00AA00	Green
CYAN			0xAAAA00	Cyan
RED				0x0000AA	Red
MAGENTA			0xAA00AA	Magenta
BROWN			0x0055AA	Brown
LIGHTGRAY		0xAAAAAA	Light Gray
DARKGRAY		0x555555	Dark Gray
LIGHTBLUE		0xFF5555	Bright Blue
LIGHTGREEN		0x55FF55	Bright Green
LIGHTCYAN		0xFFFF55	Bright Cyan
LIGHTRED		0x5555FF	Bright Red
LIGHTMAGENTA	0xFF55FF	Bright Magenta
YELLOW			0x55FFFF	Yellow
WHITE			0xFFFFFF	White

2. Represents a color with a hexadecimal number

Hexadecimal color representation rule is: 0xbbggrr (bb=Blue, gg=Green, rr=Red)

3. Compose a color with RGB macros

See RGB for details.

4. Convert other color models to RGB color with HSLtoRGB and HSVtoRGB function

See HSLtoRGB, HSVtoRGB for details.

Examples

Here are some ways to set the color of the drawing line:

setlinecolor(0xff0000);
setlinecolor(BLUE);
setlinecolor(RGB(0, 0, 255));
setlinecolor(HSLtoRGB(240, 1, 0.5));
(贡献者:Krissi  编辑