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

# PreferredColorSchemeKey

A key for specifying the preferred color scheme.

```
struct PreferredColorSchemeKey
```

## Overview

Don’t use this key directly. Instead, set a preferred color scheme for a
view using the [`preferredColorScheme(_:)`](/documentation/SwiftUI/View/preferredColorScheme(_:)) view modifier. Get the
current color scheme for a view by accessing the
[`colorScheme`](/documentation/SwiftUI/EnvironmentValues/colorScheme) value.

## Relationships

### Conforms To

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

---

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)