Skip to content

dev_set_colorπŸ”—

Short descriptionπŸ”—

dev_set_color β€” Set one or more output colors.

SignatureπŸ”—

dev_set_color( string ColorName )

DescriptionπŸ”—

dev_set_color defines the color(s) that are used to display regions, XLDs, and other geometrical objects in the graphics windows. The available colors can be queried with the operator query_color. In addition, the ColorName may be specified as hexadecimal RGB triplet or RGBA quadruplet in the form '#rrggbb' and '#rrggbbaa'. β€˜rr’, β€˜gg’, β€˜bb’, and β€˜aa’ are hexadecimal numbers between β€˜00’ and β€˜ff’, respectively. β€˜aa’ denotes the alpha value of a color and can be used to display transparent regions.

For more information see the description of the operator set_color. However, in contrast to that operator the color setting is also used for all new graphics windows that are opened afterwards.

These color settings remain valid until dev_set_color or dev_set_colored is called or until the color settings are modified interactively.

Examples of possible color strings

AttentionπŸ”—

Using the code export feature of HDevelop, the code that is generated for this operator may have a different behavior than the related HALCON operator. For a detailed description of the code export of HDevelop graphics operators into the different programming languages see in the β€œHDevelop User's Guide” the chapter Code Export -> General Aspects of Code Generation -> Graphics Windows.

ParametersπŸ”—

ColorName (input_control) string(-array) β†’ (string)

Output color names.

Default: 'white'
Suggested values: 'white', 'black', 'gray', 'red', 'green', 'blue', '#003075', '#e53019', '#ffb529'

ExampleπŸ”—

(HDevelop)

read_image(Image,'mreut')
dev_set_draw('fill')
dev_set_color('red')
threshold(Image,Region,180,255)
dev_set_color('green')
threshold(Image,Region,0,179)

ResultπŸ”—

If the values of the specified parameters are correct, dev_set_color returns 2 (H_MSG_TRUE). Otherwise, an exception is raised and an error code returned.

Combinations with other operatorsπŸ”—

Combinations

Possible predecessors

dev_open_window, query_color, query_all_colors

Possible successors

dev_display

Alternatives

dev_set_colored

See also

dev_set_draw, dev_set_line_width, set_color

ModuleπŸ”—

Foundation