imgui-knobs icon indicating copy to clipboard operation
imgui-knobs copied to clipboard

Custom colors for primary, secondary and track colors

Open Simon-L opened this issue 1 year ago • 2 comments

Having the feature to select custom colors for each parts of the knobs could bring a lot of styling capabilities to this excellent library!

There are functions defined for this here: https://github.com/altschuler/imgui-knobs/blob/main/imgui-knobs.cpp#L203-L224

One workaround is to wrap the Knob() call in Push/PopStyleColor() for each colors used (namely ImGuiCol_ButtonActive and ImGuiCol_ButtonHovered for primary and ImGuiCol_Framebg for Track) except ImGuiCol_Framebg will likely also affect the input box background and all 6 colors can not be overriden as they are not unique so it doesn't give full customisation.

@altschuler Do you have an idea/suggestion for that? I know you're not the author of the original code from which this is ported but have you an idea of why these colors were picked up as base for the knobs initially?

I'd have to look at the style editor again but if there are enough unique colors sharing the same default (in dark and light theme) then they could be used instead as base/hovered/active triple and allow each to be overriden as explained above. Hope that makes sense.

Another solution is adding yet another 2/3 optional arguments to Knob()

PS: https://github.com/Simon-L/minisilver/blob/dev/src/imgui-knobs-svg.h for my usecase I wanted fancier knobs so I went ahead and added SVG background and front element!

Simon-L avatar Mar 30 '23 21:03 Simon-L