struct ColorPicker
Swift
struct ColorPicker
Saturation–value square, hue strip, hex, and an optional alpha slider.
The binding is an authored sRGB Color — the same numbers a picker and
a hex field agree on. The square is HSV rather than HSL because the
top-right corner has to be the pure hue; HSL puts that in the middle
and feels like the control is fighting the hand.
@State private var fill = Color(r: 0.2, g: 0.45, b: 0.8)
ColorPicker(color: $fill)
Sources/LavaUI/ColorPicker.swift:14
Constructors
init(color: Binding<Color>, showsAlpha: Bool = false, showsHex: Bool = true)
Creates a picker bound to color.
Sources/LavaUI/ColorPicker.swift:28
Properties
var body: some View { get }
Not documented.
Sources/LavaUI/ColorPicker.swift:38
@Binding var color: Color { get nonmutating set }
The colour being edited.
Sources/LavaUI/ColorPicker.swift:16
var showsAlpha: Bool
Whether to show an opacity slider.
Sources/LavaUI/ColorPicker.swift:18
var showsHex: Bool
Whether to show a hex text field.
Sources/LavaUI/ColorPicker.swift:20