ColorPickerButton

struct ColorPickerButton: View

SwiftUI View with a Button to select a Color

  • Binding to the selected color

    Declaration

    Swift

    var selectedColor: Color
  • The label that goes in front of the button

    Declaration

    Swift

    let label: String
  • Bool to show the popup

    Declaration

    Swift

    private var showPopup: Bool = false
  • All the available dynamic colors

    Declaration

    Swift

    private let dynamicColors: [Color] = [
        .primary,
        .secondary,
        .accentColor
    ]
  • All the available system colors

    Declaration

    Swift

    private let systemColors: [Color] = [
        .black,
        .blue,
        .brown,
        .cyan,
        .gray,
        .green,
        .indigo,
        .mint,
        .orange,
        .pink,
        .purple,
        .red,
        .teal,
        .white,
        .yellow
    ]
  • The body of the View

    Declaration

    Swift

    var body: some View
  • The View for the label

    Declaration

    Swift

    private func label(color: Color) -> some View