---
title: "isSystemInDarkTheme"
description: "Returns whether the operating system is in dark theme.

This function should be used to help build responsive UIs that follow the system setting, to
avoid harsh contrast changes when switching between applications.

It is recommended for this to be used at the top level of the application, to create theming
objects such as a set of colors that can be provided through the hierarchy. This way, screens and
components don't need to be aware of the system theme setting, they just consume properties from
the theming object. This also makes it easier to support user-defined overrides, such as forcing
light / dark theme regardless of the system setting."
type: "composable"
---

<div class='type'>Composable Function</div>


<a id='references'></a>

<div class='sourceset sourceset-common'>Common</div>


```kotlin
@Composable @ReadOnlyComposable fun isSystemInDarkTheme() = _isSystemInDarkTheme()
```


Returns whether the operating system is in dark theme.

This function should be used to help build responsive UIs that follow the system setting, to
avoid harsh contrast changes when switching between applications.

It is recommended for this to be used at the top level of the application, to create theming
objects such as a set of colors that can be provided through the hierarchy. This way, screens and
components don't need to be aware of the system theme setting, they just consume properties from
the theming object. This also makes it easier to support user-defined overrides, such as forcing
light / dark theme regardless of the system setting.

#### Returns

| | |
| --- | --- |
|  | `true` if the system is considered to be in 'dark theme'. |





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

