The following code is a slightly reworked snippet ...
# compose-desktop
t
The following code is a slightly reworked snippet from the Android Compose sample app.
Copy code
val colors = if (isSystemInDarkTheme()) {
    darkColors()
} else {
    lightColors()
}
Doesn't work because isSystemInDarkTheme() is not found. On the Android side it is currently resolved through foundation-1.0.0-alpha04. So, am I mistaken assuming Compose Desktop relies on another (earlier) version of androidx.compose.foundation? If I got something completely wrong, please forgive me, still apprenticing Compose Desktop. :-)
i
isSystemInDarkTheme
is only implemented for Android target. You can use it in only-android project if you depends on "androidx.compose" artifacts.. Or in Android target in MPP project if you depends on "org.jetbrains.compose" artifacts. For desktop target it isn't implemented. I created a feature request here: https://github.com/JetBrains/compose-jb/issues/169
👍 1
t
Thanks a lot for creating the feature request. Already voted for it.😎