Guide / Controls / Inputs

Color

Pick a color

When to use it. A color selection control. Stores a .string value (hex color like "#FF6B6B").

Type
colorPicker
Also titled
Color Picker
Default size
1 row × 1 column
Symbol
paintpalette.fill
Docs
Docs complete
Search for it as
  • colour
  • palette
  • swatch
  • hue
  • rgb
  • paint
Color: Room light color
Rendered by the app

Fields

6 fields you can set on a colorPicker control. Every control also takes the shared fields (id, position, span, sync, action).

Fields
FieldTypeDefaultWhat it does
Labellabeltext—

The name shown above

Shows this text above the color swatch.

defaultValuedefaultValuetext—

The starting color

Sets the color shown before anyone picks one, as a hex value like #F4B860.

Symbolicontext—

A small picture beside the name

Draws this SF Symbol beside the label; leave it empty for no icon.

Symbol colortintcolor—

The color of the small picture

Colors the symbol beside the label, as any hex color.

Title shownhideLabelon / offfalse (off)

Hide the title

Hides the label shown above the color swatch.

No background cardhideBackgroundon / offfalse (off)

Whether the card behind it is drawn

Removes the frosted card behind the swatch so it sits on the page.

Theme fields

Restyle one control by setting these in its theme object; a layout's theme sets them for every control.

Theme fields
FieldTypeDefaultWhat it does
cornerRadiustheme.cornerRadiusnumber0–30 ptstep 112

The quieter text color

Colors the smaller, secondary text.

borderColortheme.borderColorcolor#FFFFFF1A

The outline color

Colors the outline drawn around the control.

borderWidththeme.borderWidthnumber0–5 ptstep 0.51

Size of the title text

Sets the title text size from 8 to 24 pt.

Emits and receives

What this control sends when you use it, and what it can show or follow when data arrives.

Emits

Emits
SendsWhenTypeWhat it sends
When you choose a colorvaluechangecolor

the color you chose, as a hex code

The system color sheet sends as you drag through colors, so one visit can send several times; there is no transparency

Example: #7F8CFF

Receives

Receives
TakesFromTypeWhat it does
valuefollowhub, mqtt, http, store, defaultcolor

a color to show on the swatch, as a hex code

the swatch changes to it without sending anything; your next choice replaces it

Example: #7F8CFF

Sample

The placeholder value the editor shows before real data arrives.

  • #7F8CFF then #7FFF8C

Examples

3 examples, each one a control you can paste into a layout.

Room light color

JSON 8 lines
{
  "type": "colorPicker",
  "id": "lr-color",
  "position": [1, 3],
  "defaultValue": "#F4B860",
  "label": "Color",
  "action": { "method": "meshsocket", "mode": "send", "event": "route_msg_noreply", "payload": { "target_name": "hue-bridge", "type": "color", "payload": { "room": "living", "hex": "{{value}}" } } }
}

Open in CAR-TER

Color: Room light color
Rendered by the app

Accent color with an undo note

Tap to pick a color, with a short Undo pill after each change.

JSON 8 lines
{
  "type": "colorPicker",
  "id": "accent-color",
  "position": [0, 0],
  "label": "Accent",
  "defaultValue": "#667EEA",
  "confirm": true
}

Open in CAR-TER

Labelled swatch with a custom look

A squarer swatch with a thicker outline and larger label.

JSON 8 lines
{
  "type": "colorPicker",
  "id": "strip-color",
  "position": [0, 1],
  "label": "Strip",
  "defaultValue": "#FF6B6B",
  "theme": { "cornerRadius": 4, "borderWidth": 2, "labelFontSize": 16 }
}

Open in CAR-TER

Try it on your phone

carterkit serves a small hub on your computer and pushes one example to CAR-TER on your iPhone or iPad. Pair once with the code it prints.

  1. Install the Python kit.

    pip install carterkit
  2. Show “Room light color” on your phone.

    carterkit demo colorPicker --example 'Room light color'
  3. Swap in any example name from this page, or leave --example off for the first one.

carterkit quickstart · Get CAR-TER

Behavior

  • Shows the iOS system color picker on tap
  • Value stored and transmitted as #RRGGBB hex string
  • {{value}} in actions is the hex string

Generated from ControlDocs/color-picker.md. Something unclear or missing? Tell me.