jvcleave / ofxImGui

Use ImGui in openFrameworks
292 stars 123 forks source link

how can we add the color picker expanded by default? #92

Closed moebiussurfing closed 4 years ago

moebiussurfing commented 4 years ago

ofxImGui::AddParameter(this->color_picked, true); When we click on a color widget the color picker wheel it opens his window. Then when right-clicking it open both modes: rectangle or triangle controllers.

We can change from RGB number setters to HSV, so maybe there is a nice way to add HSV "direct (not external)" float sliders without overflow the callbacks..

How we can show a picker on the panel to show by default? So we don't need to click to open?

(Also would be nice to get the position (or where/how it opens) to recall on settings.)

Screen Shot 2019-07-23 at 23 33 43 Screen Shot 2019-07-23 at 23 33 36 Screen Shot 2019-07-23 at 23 33 23

this->gui.begin();
    {
        if (ofxImGui::BeginWindow("COLOR MANAGER", mainSettings, false))
        {
            if (ofxImGui::BeginTree(this->params_control, mainSettings))
            {
                // COLOR
                ofxImGui::AddParameter(this->color_picked, true);

                ofxImGui::AddParameter(this->color_HUE);
                ofxImGui::AddParameter(this->color_SAT);
                ofxImGui::AddParameter(this->color_BRG);

                ofxImGui::EndTree(mainSettings);
            }
//...
moebiussurfing commented 4 years ago

Ok. I see how to do it:

// ImGui::ColorEdit3("Background Color", (float*)&backgroundColor);
ImGui::ColorPicker3("Background Color", (float*)&backgroundColor);

also you can set some settings of the color picker like this:

 ImGuiColorEditFlags_AlphaBar |
        ImGuiColorEditFlags_AlphaPreview |
        ImGuiColorEditFlags_HSV |
        ImGuiColorEditFlags_PickerHueWheel;
        ImGui::ColorPicker4("Background Color", (float*)&backgroundColor, colorEdiFlags);

all the available settings can be found here in imgui.h:

// Enumeration for ColorEdit3() / ColorEdit4() / ColorPicker3() / ColorPicker4() / ColorButton()
enum ImGuiColorEditFlags_
{
    ImGuiColorEditFlags_None            = 0,
    ImGuiColorEditFlags_NoAlpha         = 1 << 1,   //              // ColorEdit, ColorPicker, ColorButton: ignore Alpha component (read 3 components from the input pointer).
    ImGuiColorEditFlags_NoPicker        = 1 << 2,   //  
...
moebiussurfing commented 4 years ago

Screen Shot 2019-07-28 at 19 00 37