Skip to content

declarative::color_picker::ColorView#

View that displays a single color.

Header:#include <AUI/View/AColorPicker.h>
CMake:aui_link(my_target PUBLIC aui::views)

Detailed Description#

The ColorView simply renders a solid rectangle matching the provided color contract. It is intended to be used as a visual preview of a color value.

#include <AUI/Platform/Entry.h>
#include <AUI/Platform/AWindow.h>
#include <AUI/View/AColorPicker.h>

using namespace ass;
using namespace declarative;


class MainWindow : public AWindow {
public:
    MainWindow() : AWindow("Color picker", 600_dp, 300_dp) {
        auto color = _new<AProperty<AColor>>(AColor::RED);
        setContents(Vertical {
          GroupBox {
            Label { "View" },
            color_picker::ColorView { AUI_REACT(**color) } AUI_OVERRIDE_STYLE {
                  FixedSize(40_dp, 20_dp),
                  Border { 1_px, AColor::BLACK },
                  Padding { 2_px },
                },
          },
          GroupBox {
            Label { "Sliders RGB" },
            color_picker::SlidersRGB {
              .color = AUI_REACT(**color),
              .onColorChanged = [color](AColor c) { *color = c; },
            },
          },
        });
    }

};

AUI_ENTRY {
    _new<MainWindow>()->show();
    return 0;
}

Public fields and Signals#


color#

contract::In<AColor> color

The color to display.