admin管理员组

文章数量:1305092

I have a kotlin multiplatform app, where I use isSystemInDarkTheme() to determine if the system has dark mode set. However, for the generated webapp, isSystemInDarkTheme() always returns false. I tested this on Firefox and Chromium.

Is this a bug? Do I need to use another function for web?

I have a kotlin multiplatform app, where I use isSystemInDarkTheme() to determine if the system has dark mode set. However, for the generated webapp, isSystemInDarkTheme() always returns false. I tested this on Firefox and Chromium.

Is this a bug? Do I need to use another function for web?

Share Improve this question edited Feb 4 at 10:05 VLAZ 29.1k9 gold badges63 silver badges84 bronze badges asked Feb 4 at 9:55 Julian EgnerJulian Egner 2814 silver badges9 bronze badges 2
  • similar issue youtrack.jetbrains/issue/CMP-5871 – lisonge Commented Feb 4 at 16:23
  • @lisonge No, thats not the same issue. In the page linked by you, it is said that "isSystemInDarkTheme returns the correct value in desktop mac apps. However, changing the system theme does not trigger recomposition." My problem is that in web, the isSystemInDarkTheme() function always returns false and NEVER the correct value. It has nothing to to with updating the value like the iOS Problem you stated and also other findings. – Julian Egner Commented Feb 5 at 8:00
Add a comment  | 

1 Answer 1

Reset to default 0

I upgraded to the latest kotlin version (2.1) and now isSystemInDarkTheme() works as expected.

My way to upgrading was generating a new kotlin multiplatform app (https://kmp.jetbrains/) and then putting the relevant import statements into my project.

本文标签: kotlinisSystemInDarkTheme() always returns false on webStack Overflow