-
-
Notifications
You must be signed in to change notification settings - Fork 10.5k
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
Using gradients in widgets #4722
Comments
Looks great! Hoping to see this merged to Styling V2 soon. Till then I guess working up from this function for other widgets would be the way to go for most users who want to add gradient-colored widgets? |
I would suggest people to not go too far with this as you are likely to be increasingly dependent on internals and possible mods to your copy. But technically you could hack imgui sources (you are on your own) or just use this on a few selected widgets for now (Button being a great candidate). |
Hello, I've been reading up on the state of gradient capabilities throughout the project, and explored some users' custom gradient widgets before phrasing a question (@moebiussurfing was kind enough to introduce me to the work of CoolLibs and effekseer). Something I have failed to understand as of writing is the application of these gradients to existing color settings in Dear ImGui. Essentially, I would like to apply a two-color gradient to ImGuiCol_Border to create a multicolored window border. I still plan to examine AddRectFilledMultiColor to see if I can generalize anything about how to incorporate more than one ImColor, but any insights or suggestions would be much appreciated. (Also this is my first question directly to this GitHub, and after reading Contributing.md thought it be better placed under this issue than creating a new post; if there's any ediquette I didn't follow please lmk so I know for next time!). Thanks! |
Following a nice screenshot posted recently I thought about opening a topic to gather ideas about using gradients.
We've experimented with this for a while actually. The plan is that Styling V2 (NO ETA) should support the use of gradients on filled surfaces. This has been the plan for a long time (#1223) and still is, but hey, resources. In the meanwhile it is reasonably easy to add gradients to SOME widgets by rewiring a few functions. I noticed that merely using a button with gradient can help a lot with visuals (the problem with this approach is that mixing your own buttons with other codes you won't get the nicer style on the "other code", something which styling v2 should address).
As part of work on shadows (#1329 (comment)) I attempted such hack:
I also commissioned @ShironekoBen last year to run some private experiments of 100% custom widgets trying to mimick the style of Unity and OSX: (those 2 are dear imgui screenshots with custom widgets)
One of the underlying goal is to figure out two things:
Recently @martinpetkovski posted about their work on NST (#4451 (comment)) which suggested that with a simple custom button widget you can actually get really good results without much code nor hacking:
Today I sat down to write a button widget.
I copied imgui_widgets.cpp
ButtonEx()
into my own source file and modified it.It's currently an awkward amount of code because some internals are not prepared for it yet.
Usage
Future simplification will be that:
Button()
with no parameter use gradient from style)The text was updated successfully, but these errors were encountered: