I am trying to let my users manually select dark mode independently from the system settings. On non-compose apps I just used
AppCompatDelegate
to change dark mode but on my Compose app it has no effect.
It looks like
isSystemInDarkTheme()
just checks the system settings and even when I use my own function to check dark mode, it only effects the Compose MaterialTheme colors which I don't use much. I use resources for dark/light colors and it works fine except this.
How can I handle this in Compose? It does not look like
AppCompatDelegate
has any effect on Compose.
c
Chris Sinco [G]
04/22/2021, 10:53 PM
Have you looked at the Jetsnack sample? That demonstrates how to use a bespoke color system that doesn’t use Material colors
👀 1
Chris Sinco [G]
04/22/2021, 10:54 PM
Still uses MaterialTheme, but I think it can help with what you are looking for
Chris Sinco [G]
04/22/2021, 10:55 PM
Also, by default, there is a default set of dark colors available to you in Compose based on the Material dark theme guidelines (
darkColors()
) but it’s entirely in your control to pass them into
MaterialTheme
that is at the root of your Compose app hierarchy.
isSystemInDarkTheme()
is there for convenience, but the conditional can be custom as you mentioned.