One Logo Pool Ball
SwiftUICore · IOS API REFERENCE

ColorScheme

enum · iOS 13.0+ · SDK 27.1

enum ColorScheme

The possible color schemes, corresponding to the light and dark appearances. You receive a color scheme value when you read the ``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`` 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 ``View/preferredColorScheme(_:)`` view modifier.

Members (1)

get · iOS 13.0+

allCases

TypeScript
get allCases(): Array<ColorScheme>
Swift declaration
nonisolated static var allCases: [ColorScheme] { get }

A collection of all values of this type.

Skipped declarations

No declarations were skipped in this snapshot.

All SwiftUICore types →