How can I check whether the system theme is dark or light mode? #1627
Unanswered
BC-clegras
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Hm, looks like there is no way to know that. Let's create an issue to implement that. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Question
I have a button in my code that switches between light mode and dark mode, which works great, but I would like to know how I can check if the system theme is dark or light.
Right now, I hardcode
page.theme_mode = ft.ThemeMode.LIGHT
, since the code for my button assumes that the system starts in light more. I would love to use theft.ThemeMode.SYSTEM
property, but I can't figure out how to check if system means dark or light mode, and therefore there will always be a scenario where an extra click will be needed at the start if the user wants to switch between light and dark mode.Basically, I would like to be able to know what state the app starts in so I can make the button I use for dark mode have the correct icon and tooltip at startup.
Code sample
Error message
No response
------------------------------------------------------
Beta Was this translation helpful? Give feedback.
All reactions