<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/ColorPicker/init(_:selection:supportsOpacity:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI11ColorPickerVA2A4TextVRszrlE_9selection15supportsOpacityACyAEG10Foundation23LocalizedStringResourceV_AA7BindingVySo10CGColorRefaGSbtcfc::OverloadGroup"
  },
  "title" : "init(_:selection:supportsOpacity:)"
}
-->

# init(_:selection:supportsOpacity:)

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

```
@export(implementation) nonisolated init(_ titleResource: LocalizedStringResource, selection: Binding<CGColor>, supportsOpacity: Bool = true)
```

## Parameters

`titleResource`

The localized title of the picker.

`selection`

A [`Binding`](/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`.

---

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)