<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/ColorScheme",
  "metadataVersion" : "0.1.0",
  "role" : "Enumeration",
  "symbol" : {
    "kind" : "Enumeration",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI11ColorSchemeO"
  },
  "title" : "ColorScheme"
}
-->

# ColorScheme

The possible color schemes, corresponding to the light and dark appearances.

```
enum ColorScheme
```

## Overview

You receive a color scheme value when you read the
[`colorScheme`](/documentation/SwiftUI/EnvironmentValues/colorScheme) environment value. The value tells you if
a light or dark appearance currently applies to the view. SwiftUI updates
the value whenever the appearance changes, and redraws views that
depend on the value. For example, the following [`Text`](/documentation/SwiftUI/Text) view automatically
updates when the user enables Dark Mode:

```
@Environment(\.colorScheme) private var colorScheme

var body: some View {
    Text(colorScheme == .dark ? "Dark" : "Light")
}
```

Set a preferred appearance for a particular view hierarchy to override
the user’s Dark Mode setting using the [`preferredColorScheme(_:)`](/documentation/SwiftUI/View/preferredColorScheme(_:))
view modifier.

## Topics

### Getting color schemes

[`ColorScheme.light`](/documentation/SwiftUI/ColorScheme/light)

The color scheme that corresponds to a light appearance.

[`ColorScheme.dark`](/documentation/SwiftUI/ColorScheme/dark)

The color scheme that corresponds to a dark appearance.

### Creating a color scheme

[`init(_:)`](/documentation/SwiftUI/ColorScheme/init(_:))

Creates a color scheme from its user interface style equivalent.

### Supporting types

[`PreferredColorSchemeKey`](/documentation/SwiftUI/PreferredColorSchemeKey)

A key for specifying the preferred color scheme.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)