inputs/DSColorPicker

DSColorPicker

inputs
since v2.0

Colour swatch grid with a custom-colour option via the system colour picker. Supports a predefined palette.

iOS 17+macOS 14+

Purpose

Label colours, project/tag colour assignment, and theme customisation.

Props

PropTypeDefaultDescription
selectionreqBinding<Color>โ€”Currently selected colour.
palette[Color]DSColor.paletteSwatch colours to display.
labelString?nilField label.
allowCustomBooltrueShows the system colour picker as the last swatch.

Examples

Project colour

Colour picker in a project creation form.

swift
DSColorPicker(
    selection: $project.color,
    label: "Project colour",
    palette: [.red, .orange, .yellow, .green, .blue, .purple, .pink]
)

Related Components