How to check if current theme is dark, without che...
# compose
k
How to check if current theme is dark, without checking for
system
theme?
z
Using the same way you're setting the theme to dark. Usually this is a Boolean value or whatever
k
Not sure if I understand. Considering the dark theme is being set on very top, how can my nested components know about this variable? Previously I do remember we had some LocalComposition, but I am unable to find it now, all I see is
isSystemDarkTheme()
o
What is wrong then with
isSystemDarkTheme
? It should be observable, thus your component will recompose on change
k
App will be able to change theme at runtime. That being said, I'll just grab the variable from implementation.
z
If you are persisting the newly selected theme to a database such as DataStore then you can simply observe that key from your database At the very top of your application you observe, down the road you write to it