Skip to content
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

Add property to evaluate if app is in dark mode #2841

Open
freakboy3742 opened this issue Sep 14, 2024 · 0 comments
Open

Add property to evaluate if app is in dark mode #2841

freakboy3742 opened this issue Sep 14, 2024 · 0 comments
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!

Comments

@freakboy3742
Copy link
Member

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 as is 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.

@freakboy3742 freakboy3742 added 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! labels Sep 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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!
Projects
None yet
Development

No branches or pull requests

1 participant