is this the better way to change between light and...
# compose
c
is this the better way to change between light and dark mode?
Copy code
setContent {
            val (mode, setMode) = state { lightColorPalette() }
            MaterialTheme(mode) {
                Button(onClick = { setMode(if (mode.isLight) darkColorPalette() else lightColorPalette()) }) {
                    Text(text = "button")
                }
            }
        }
l
That's the idea, essentially. Additionally, you can use isSystemInDarkTheme to query the system wide dark theme, such as in the samples
👍 2