Field type
color
Color picker pulling its palette from the active theme.json. Renders as a small swatch that opens a popover with the theme palette and (optionally) a gradients tab.
Type: color · Stored attribute type: string
Stored value
string — hex like "#5956E9", a theme palette slug, or a CSS gradient string when gradients are enabled.
Supports
- Theme palettes — values from
settings.color.palettein theme.json appear automatically. - Gradients — when
showGradients: true, a second tab lets the author pick a CSS gradient. Stored in the same attribute as the color (string). - Dual-attribute mode — set
gradientAttributeKeyto write color and gradient to separate attributes if your render path needs them apart. - A look of its element — bound to a CSS property (
data-gcb-look="<key>:<property>"on the element, the properties in includes/Contract/look-props.json), the value paints that property as a style (Contract\Fields::look_style, src/controls/look-value.js) instead of printing as words.
Config options
| Option | Type | Default | Description |
|---|---|---|---|
showGradients | boolean | false | Show the gradient picker tab. When false (default) the popover is color-only. |
gradientAttributeKey | string | Optional. If set, the gradient value is stored in this attribute instead of the same one as the color. Useful when your render.php / React component expects color and gradient as separate props. |
Gotchas
- Stored value is a single string —
"#5956E9"(color) OR"linear-gradient(...)"(gradient). Renderers should accept either shape unless dual-attribute mode is in use.
Example
{ "id": "ctrl_accent",
"type": "color",
"label": "Accent",
"attributeKey": "accent",
"default": "#5956E9",
"showGradients": true,
"parentPanelId": "panel" }Every field also takes the keys common to all fields.