Summary
Extend field.color() (see issue 01) with a .palette(brandTokens) modifier that constrains the picker to a fixed color palette. Free hex remains available as an explicit opt-in via .allowCustom(true).
Why this would help
- Design-system-aware forms, theme editors, label / category selectors that must stay on-brand.
- Today users either use
field.select() with hard-coded options (and lose the visual swatches) or field.color() and police the value at submit time.
- A palette-constrained picker is a one-line change once the base
color field exists.
Proposed API
field.color('Label color')
.palette(['#0f6fdc', '#22c55e', '#f59e0b', '#ef4444'])
.allowCustom(false);
Suggested implementation areas
src/core/field-descriptors/color/ColorFieldBuilder.ts — depends on issue 01
- a
palette validator that rejects values outside the configured set when allowCustom(false)
src/renderers/web/ and src/renderers/native/ — swatch grid + optional free-form input toggle
Acceptance Criteria
Summary
Extend
field.color()(see issue 01) with a.palette(brandTokens)modifier that constrains the picker to a fixed color palette. Free hex remains available as an explicit opt-in via.allowCustom(true).Why this would help
field.select()with hard-coded options (and lose the visual swatches) orfield.color()and police the value at submit time.colorfield exists.Proposed API
Suggested implementation areas
src/core/field-descriptors/color/ColorFieldBuilder.ts— depends on issue 01palettevalidator that rejects values outside the configured set whenallowCustom(false)src/renderers/web/andsrc/renderers/native/— swatch grid + optional free-form input toggleAcceptance Criteria
allowCustom(false)allowCustom(true)reopens the standard color picker as a secondary path