Composable Function

isSystemInDarkTheme

Returns whether the operating system is in dark theme.

DarkThemeSample

@Composable
fun DarkThemeSample() {
    val dark = isSystemInDarkTheme()
    val color = if (dark) Color.White else Color.Black
    Box { Box(Modifier.size(50.dp).background(color = color)) }
}