Add property to evaluate if app is in dark mode #2841
Labels
enhancement
New features, or improvements to existing features.
good first issue
Is this your first time contributing? This could be a good place to start!
What is the problem or limitation you are having?
Most operating systems now have a concept of "dark mode"; if you're manually setting colors for labels or other text, you need to know if you're in dark mode to be able to determine if a label color should be high or low contrast.
Describe the solution you'd like
toga.App.dark_mode
should return True if the app is in dark mode, False otherwise.It might make sense to return
None
on platforms where this can't be determined (e.g., the platform doesn't have an explicit concept of "dark mode". This would evaluate as false-y, while still be checked asis None
.Describe alternatives you've considered
Ideally, color selection is something that would be done with a full style sheet with media selectors; however, that requires a full CSS implementation (see Colosseum); and regardless, colosseum would still require an app's style applicator to provide the current dark/light mode as an input to the style process.
Additional context
See #2830 for the original request.
This will require an implementation on every backend, calling native APIs to determine dark mode status.
The text was updated successfully, but these errors were encountered: