Skip to content

ColorPicker

HSV Color Space Selector

The ColorPicker provides an HSV color space model with gradient image caching (three QImage buffers rebuilt only when dirty flags trigger), dual input modes (Hex/RGB), and alpha channel support with checkerboard visualization.

ColorPicker

The ColorPicker showing HSV gradient selection with hue strip, opacity slider, and hex input (#C94444).

Key Features

HSV Gradient Selection

A 2D saturation-value gradient panel with a vertical hue strip. The gradient images are cached and only rebuilt when the hue changes (dirty-flag optimization).

Dual Input Modes

Switch between Hex code input (#RRGGBB) and individual R/G/B numeric inputs.

Alpha Channel

Optional opacity slider with checkerboard background visualization for transparency preview.

Main Properties

Property Type Description
Color QColor Currently selected color
Alpha int Alpha channel value (0-255)
Hex QString Hex color string (#RRGGBB)
ShowAlphaSlider bool Display opacity slider
InputMode int 0 = Hex, 1 = RGB
BorderRadius int Widget corner radius
Color_Background QVariant Widget background color
Shadow_Enabled bool Drop shadow effect
Shadow_Color QColor Shadow color
Shadow_Radius int Shadow blur radius

Note: This widget exposes 11 configurable properties. The table above covers the full set of available configuration options.

Usage Example in WinCC OA

XML Configuration (extended properties)

<extended>
  <prop name="minimumSize">-1 300</prop>
  <prop name="maximumSize">300 -1</prop>
  <prop name="ShowAlphaSlider" type="BOOL">True</prop>
  <prop name="BorderRadius" type="INT">8</prop>
  <script name="colorChanged">colorChanged(string hex, int r, int g, int b, int a)</script>
</extended>

CTRL Initialization Script

main()
{
  // Set initial color from datapoint
  string hexColor = dpGet("Config.Theme.AccentColor");
  EWO.setColorRGBA(0, 120, 212, 255);
}

// Handle color selection
void colorChanged(string hex, int r, int g, int b, int a)
{
  dpSet("Config.Theme.AccentColor", hex);
  DebugN("Selected color:", hex, "RGBA:", r, g, b, a);
}

Available Signals

Signal Parameters Description
colorChanged hex, r, g, b, a Color selection changed
hexChanged hex Hex value updated
alphaChanged alpha Alpha slider moved