aui-framework / aui-framework/aui
Light/dark theming
- Dominant language
- C++
- Stars
- 600
- Forks
- 44
- Avg merge
- 17h 56m
- Merged PRs (30d)
- 3
Description
A solution is needed for light/dark theming. It's probably depends on #572.
- If possible, light/dark theme of system UI elements should be implemented as well. (#675)
## API sketch
```cpp
namespace aui::theme {
// 1. enum
enum class Theme { // i don't like this name, just for sake of demo
LIGHT,
DARK,
HIGH_CONTRAST, // etc...
};
// 2. this reflects setting in OS settings
// Windows: Settings -> System -> Theme -> Dark/light
// Linux: depends on DE
const AProperty& systemPreference();
// 3. main observable for theme value
//
// this is up to be defined by AUI-based application.
// by default, we'll return light theme because the application
// developer might not know/care about light/dark themes.
//
// if they want, they'll override application preference to
//
// appPreference = [] { return *aui::theme::systemPreference(); }
//
// or, if they want to introduce their application-specific setting,
//
// appPreference = [] {
// // assuming AProperty> theme
// if (MyAppSettings::theme->hasValue()) {
// return MyAppSettings::theme->value();
// }
// return *systemPreference();
// }
APropertyPrecomputed appPreference = [] { return Theme::LIGHT; }
//
// this value should be observed in entire application. If AUI can adjust system UI elements
// (i.e., titlebars #675), appPreference will affect them too.
}
// 4. Assuming #572 is resolved (at least partially)
// AUI_OVERRIDE_STYLE implicitly subscribes for aui::theme::appPreference changes
static _ myThemeAwareButton() {
return Button { ... } AUI_OVERRIDE_STYLE {
BackgroundSolid(aui::theme::appPreference == Theme::LIGHT ? AColor::WHITE : AColor::BLACK),
};
}
```
Contributor guide
Research direction
Start with the API sketch in this issue and review dependencies #572 and #675, including the system UI theming requirement. Define how application and system preferences should be observed across supported platforms, then verify that theme-aware styles update and that the requested system UI behavior is addressed where possible.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- desktop
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100