DarkThemeSample
@Sampled
@Composable
fun DarkThemeSample() {
val dark = isSystemInDarkTheme()
val color = if (dark) Color.White else Color.Black
Box { Box(Modifier.size(50.dp).background(color = color)) }
}Returns whether the operating system is in dark theme.
CodeRabbit
AI writes the code. CodeRabbit catches the slop.
Robomori
Run Android emulators and devices outside Android Studio.
@Sampled
@Composable
fun DarkThemeSample() {
val dark = isSystemInDarkTheme()
val color = if (dark) Color.White else Color.Black
Box { Box(Modifier.size(50.dp).background(color = color)) }
}Content updated: