---
title: PreferredColorSchemeKey
framework: swiftui
role: symbol
role_heading: Structure
path: swiftui/preferredcolorschemekey
---

# PreferredColorSchemeKey

A key for specifying the preferred color scheme.

## Declaration

```swift
struct PreferredColorSchemeKey
```

## Overview

Overview Don’t use this key directly. Instead, set a preferred color scheme for a view using the preferredColorScheme(_:) view modifier. Get the current color scheme for a view by accessing the colorScheme value.

## Relationships

### Conforms To

- [PreferenceKey](swiftui/preferencekey.md)
