24-Bit Color Values

The Color iLCD controller supports commands for setting colors such as background color or foreground color. Although the Color iLCD controller internally works with 16-Bit Color Values, all commands except the read and write scan line commands use 24 bit color values to allow future expansions.

In the chapter Command Description, 24-bit color values are always described as type "color" in the corresponding parameter tables.

The 24-bit color value is converted to a 16-bit color value by the iLCD controller internally by using the following formula:

color_16_bit = ((red >> 3) << 11) + ((green >> 2) << 5) + (blue >> 3)

where red, green and blue are 8-bit values with a range between 0 and 255.

The color values must be set in a 24-bit format, where color_r describes the 8-bit red part, color_g the green and color_b the blue part of the 24-bit color value.

Syntax for setting the background color:

\i A C B color_r color_g color_b

Syntax in iLCD Manager XE:

\iACB\#00FF00
\iACB\x00\xFF\x00
\iACB\0\255\0

All above notations represent the same value (pure green). Refer to Syntax used in iLCD Manager XE for further information about these introducters.

The actual bytes sent via the interface can be verified in the "Hex" part of any editor panel. The sequence for the above example would look like this:

[AA][41][43][42][00][FF][00]