-
-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suggestion, about theme colors ... #2
Comments
PS: Another little idea is to treat that rounded toggles as the core buttons or sliders, Personally, that's how I am using my custom rounded toggle, and also another rectangle toggle that I have, based on the core button with custom size too. Regards! |
For design/styles: I definitely modeled my default design after @ocornut's and also the default iOS style one. I think at a minimum of what I may want to do (at least until styling v2) is perhaps a set of flags that just imply a set of nice "pre-canned" styles for someone to use out of the box. I also was noodling around on my iPad this weekend and realized I have the accessibility option turned on that shows the "I" or "O" on the frame to indicate the state of the switch for those that have a hard time seeing color, I think I'm going to add that as well. Now on to sizes I definitely like the look of your multi-size toggles as well. (Particularly those larger ones look fantastic in your theme colors too.) I'm a bit afraid of the parameter list getting a little noisy to continue adding optional things like size, but I don't see anything in I'm realizing now that there's a whole slew of things that I'd love to be easily user-controllable (that I suppose could be w/ styling v2): bounding box w/h, knob w/h, knob inset, border thickness, etc. |
I am not an expert at all on ImGui, just learning here. In the case of the regular square buttons (and custom toggles) I usually use: float w = ImGui::GetContentRegionAvail().x;
float h = ImGui::GetFrameHeight();
ImGui::Button("DoubleH", ImVec2(w, 2 * h)); Having this /*
RESPONSIVE LAYOUT
2 DOUBLE HEIGHT BUTTONS IN ONE LINE +
3 SINGLE HEIGHT BUTTONS IN ONE LINE
WITH DIFFERENT PROPORTIONS
*/
float w = ImGui::GetContentRegionAvail().x;
float h = ImGui::GetFrameHeight(); // single unit height
float hh = 2 * h; // double height
float spx = ImGui::GetStyle().ItemSpacing.x; // spacing between two widgets
float _spx;
// Calculate spacing for each line:
// _spx = (spx * (amount - 1)) / amount; // amount widgets per line
_spx = (spx * (2 - 1)) / 2;
ImGui::Button("B1", ImVec2(w * 0.25 - _spx, hh));
ImGui::SameLine();
ImGui::Button("B2", ImVec2(w * 0.75 - _spx, hh));
_spx = (spx * (3 - 1)) / 3;
ImGui::Button("B3", ImVec2(w * 1 / 3.f - _spx, h));
ImGui::SameLine();
ImGui::Button("B4", ImVec2(w * 1 / 3.f - _spx, h));
ImGui::SameLine();
ImGui::Button("B5", ImVec2(w * 1 / 3.f - _spx, h)); So, in the case of my own rounded toggle widgets, In the case of these rounded toggles, usually, Or maybe could use a flag or The simplest way to be used without any argument, float w = ImGui::GetContentRegionAvail().x; // this is the full window width
ImGui::PushItemWidth(w);
ImGui::SliderFloat("##1", &v, 0, 1); // full width without label
//ImGui::Button("Button"); // not reacting
ImGui::PopItemWidth(); But in the case of the above button, it does no reacts to that width push. float sz= 2.0f; // double H
ImGui::PushItemWidth(w);
// then internally react to the width style
// but by using it into the height + proportionally to the width.
ImGui::Toggle("Default Toggle", &toggle_a);
ImGui::PopItemWidth(); But is too dirty bc the toggle size is more related to the theme height, not dependent on the current window width. You could pick some ideas from here perhaps: static float value = 0;
ImGuiKnobFlags flags = ImGuiKnobFlags_ValueTooltip | ImGuiKnobFlags_NoTitle | ImGuiKnobFlags_NoInput;
ImGuiKnobs::Knob("Value", &value, -6.0f, 6.0f, 12 / 250.f, "%.1fdB", ImGuiKnobVariant_WiperDot, 100, flags); Sorry for the long message. A little thinking out loud... |
Not at all, I really appreciate the detailed thoughts!
This is more of a carryover from the original discussion. (Not sure where the decision to use I definitely agree that I'll thumb something out when I get a bit of free time and see what you think. |
Hey, when you get a bit to play with it, try checking out this branch and let me know what you think: https://github.com/cmdwtf/imgui_toggle/tree/feature-customization Here's a quick gif: |
I really appreciate that! I fret a lot about my C++ style, mostly because I can't decide what I want a lot of my style to be (compared to say C# where I mostly just follow Microsoft's style haha.) I'm quite glad you find it readable!
Woah those look excellent, are they in ofxSurfingImGui? I was just thinking that I was probably going to need a range slider along those lines. I use the "range" sliders often in Unity, and realized I wanted something similar for DearImGui:
This was actually intentional. I mimic'd the behavior of the checkbox, which treats it's label as part of it's interactable area too.
I've got that one fixed locally, just not super thrilled with how I've done it at the moment so I'll have it cleaned up when I merge it into main.
I'll look into this. Tweaking all of this made me realize I was handling border/padding wrong in a lot of my helper code I've got in a project, so there's a good chance I'm missing something. Please do shout if you notice specifically what it may be! |
Looks cool. This is the range slider from the above pic: I think that this range slider came from here: Here is another one but too simple: |
Fantastic! I really appreciate the links! Also: I just pushed a handful of commits and merged to main, I added a handful of more things:
Let me know if you run into any issues or bugs. And as usual, here's a gif: |
Hey,
I tried some themes to see how the colors pair with other widgets, etc...
I think that the "knob" color, it “collides”, especially with the slider grabber.
Maybe it could be cool to have the same color as the slider.
What do you think?
Regards
The text was updated successfully, but these errors were encountered: