---
title: "init(_:selection:supportsOpacity:)"
framework: swiftui
role: symbol
role_heading: Initializer
path: "swiftui/colorpicker/init(_:selection:supportsopacity:)"
---

# init(_:selection:supportsOpacity:)

Creates a color picker with a text label generated from a title string key.

## Declaration

```swift
nonisolated init(_ titleKey: LocalizedStringKey, selection: Binding<CGColor>, supportsOpacity: Bool = true)
```

## Parameters

- `titleKey`: The key for the localized title of the picker.
- `selection`: A doc://com.apple.SwiftUI/documentation/SwiftUI/Binding to the variable that displays the selected CGColor.
- `supportsOpacity`: A Boolean value that indicates whether the color picker allows adjustments to the selected color’s opacity; the default is true.

## See Also

### Creating a color picker

- [init(selection:supportsOpacity:label:)](swiftui/colorpicker/init(selection:supportsopacity:label:).md)
