hoffstadt / hoffstadt/DearPyGui
[Feature Request] Allowing configurable `enable`/`show` keywords to `theme_component`'s and theme element items `add_theme_style/color`
- Dominant language
- C++
- Stars
- 15.6k
- Forks
- 783
- PR merge metrics
- No merged PRs in 30d
Description
Theme propagation allows theme-bound items to reflect the theme elements of their parent's theme, the application theme, or the system default theme. If a theme parents a (theme component that parents a) style or color element item, all items bound to that theme will reflect that element instead -- This makes sense and works very well. However, what if it was desired to disable a theme element at runtime to allow the theme-bound items to reflect a propagated theme component/element instead? A couple of existing solutions come to mind.
First solution is rebinding or creating other themes/components. It's pretty workable for many situations. A UI design that is well-thought-out will likely have the "big" theme bound to the application. Then you could create other themes for different situations and (un)bind them to items as necessary. Another solution is to simply delete the theme component/element and re-create them later using their previous values. Unfortunately both of the above solutions boil down to either keeping track of tags of several theme-related items, or their configurations. If you're deleting theme components, you also need to be mindful of any items using them as their `source` and reconfigure those as necessary.
I feel like being able to simply enable and disable theme component and style/color items would be the most elegant solution (at least for the end-user). It would also mean that any items using those theme items as their `source` wouldn't break since the item themselves (and their values) would still exist. And if a theme element was disabled or hidden, maybe items bound to that theme could reflect an "inherited" theme element until it was enabled again? IIRC in 0.8.x, event handler items and registries had the `show` keyword and their enabled state could be changed similarly (I'm sure these exist in 1.0.x still but I haven't gotten that far yet, nor do I know if they still work this way). Since themes and event handler-related items now share a similar API and are linked to items similarly, it would make sense that they function similarly as well.
Contributor guide
Assessment
This issue has not been assessed yet.