mattinger
09/14/2020, 6:28 PMisSystemInDarkTheme()
function and decides whether to return my light or dark colors instance.Alexander Sitnikov
09/14/2020, 6:44 PM@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES)
Se7eN
09/14/2020, 6:46 PM@Composable
fun Content(isDark: Boolean = isSystemInDarkTheme()) {
...
}
Pass true
when you want to preview in dark modemattinger
09/14/2020, 6:56 PMSe7eN
09/14/2020, 6:58 PMmattinger
09/14/2020, 6:59 PMjulioromano
03/24/2021, 5:06 PMUse uiMode annotation parameter:Does this preview annotation with night mode parameter still work for you? I’ve tried many times but it still returns a light mode UI.@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES)
Alexander Sitnikov
03/24/2021, 7:10 PMjulioromano
03/24/2021, 7:31 PMMaterialTheme
with isSystemInDarkTheme()
but it seems that setting @Preview(uiMode = Configuration.UI_MODE_NIGHT_YES)
does not affect the return value of isSystemInDarkTheme()
.Alexander Sitnikov
03/24/2021, 8:38 PM