Color format

There are many different ways to represent a color. The most common formats such as Mono (1 channel grayscale value), RGB color space (3 channels color value), HSV / HLS color space (3 channels color value) are described in more detail below. However, the control offers many configuration options so that special color formats can also be set and used.

Setting the color format

To adapt the control to any color format, the general conditions can be set in detail:

The adjustments can be made via the dialog of the attribute ColorChannels. The RGB format is preset as default. For example, to set a Mono 8 format, two of the three existing channels (Object) must first be deleted. After that, the color representation can be adjusted to an average grayscale value like 128 in the R, G and B channels.

Color format 1:

Configuration examples are available for the following color formats:

Color box conversion

Color format 2:

This section is only relevant if the color box is used and the color does not correspond to the standard RGB format.

For the display of the color value by means of numbers and sliders no deeper knowledge about the color format is needed, because it is only the display of numerical values. However, in order to display the color in the color box, it must be defined how the individual color channels and their values are to be interpreted. For example, RGB values must be displayed differently than HSV values.

Since the browser-specific color input elements process RGB colors by default, all other color formats must first be converted to RGB to enable display in the color box. This conversion is to be set via the attribute BoxColorConversion. Conversion functions already exist for the formats Gray, RGBa, HSV, HSV FULL, HLS, HLS FULL, Luv, YUV and YCrCb, as well as for 8- and 16-bit data types.

Color format 3:
Color format 4:

General color converter

In addition to this special conversion function for the color box, a general color converter with the same set of color formats for general use in the HMI is also available as ConvertColor.

For completely different color formats or color formats with different scaling, user-defined functions can be created.