Files
AndroidJetpack/Jetpack-Compose-Playground/docs/cookbook/detect_darkmode.md
T
2026-07-15 16:57:36 +08:00

15 lines
547 B
Markdown

# How to detect dark mode
Inside your Composable you can use **isSystemInDarkTheme** to detect if the device is running in dark mode.
```kotlin
val dark = isSystemInDarkTheme()
```
-------------
## See also:
* [Official Docs](https://developer.android.com/reference/kotlin/androidx/compose/foundation/package-summary#issystemindarktheme)
* [Learn-Jetpack-Compose-By-Example/DarkModeActivity](https://github.com/vinaygaba/Learn-Jetpack-Compose-By-Example/blob/master/app/src/main/java/com/example/jetpackcompose/theme/DarkModeActivity.kt)