https://kotlinlang.org logo
Title
t

Thomas

12/04/2020, 4:37 PM
The following code is a slightly reworked snippet from the Android Compose sample app.
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

Igor Demin

12/04/2020, 4:52 PM
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

Thomas

12/04/2020, 5:48 PM
Thanks a lot for creating the feature request. Already voted for it.😎