title: Get Value from SwiftUI Color Picker
body: <p>iOS 14 shipped with native color pickers for UIKit (<a href="https://developer.apple.com/documentation/uikit/uicolorwell" rel="nofollow noreferrer"><code>UIColorWell</code></a>), AppKit (<a href="https://developer.apple.com/documentation/appkit/nscolorwell" rel="nofollow noreferrer"><code>NSColorWell</code></a>) and SwiftUI (<a href="https://developer.apple.com/documentation/swiftui/colorpicker" rel="nofollow noreferrer"><code>ColorPicker</code></a>).</p>
  <p>While the color wells have a property <code>selectedColor</code> that exposes the selected <code>UIColor</code>/<code>NSColor</code> values, the SwiftUI <code>ColorPicker</code> takes a <code>Binding&lt;Color&gt;</code>. However, I can't find any information how to get anything useful from the <code>Color</code> value.</p>
  <p>Creating a <code>Color</code> from a <code>UIColor</code> is easy using <a href="https://developer.apple.com/documentation/swiftui/color/init(_:)-9rl8m" rel="nofollow noreferrer"><code>Color.init(_: UIColor)</code></a> but there does not seem to be a way to get a <code>UIColor</code> from an existing <code>Color</code> or to extract the color components (e.g. the RGB values similar to the <a href="https://developer.apple.com/documentation/uikit/uicolor/1621919-getred" rel="nofollow noreferrer"><code>UIColor.getRed(_:green:blue:alpha:)</code></a> method).</p>
  <p>How do I get the underlying color values from a SwiftUI <code>ColorPicker</code>?</p>