Color Field Reference

The Color field allows content writers to select a color through a variety of color pickers and have the option to input a hex color value manually.


The Color field allows users to select a color via a color picker. It returns the color's hex code.

Screenshot of the Color field in the drag and drop editor.

The visual builder

When configuring a Color field you'll see the options to set the Field name and API ID.

Slice Machine vs. Legacy Editor

Editing fields is almost identical in Slice Machine and the Legacy editor. But it is important to know that the mock config option (to add data to preview content fields in the Slice Simulator) is only available in Slice Machine.

Screenshot of the Color field in the Custom Type Builder.

JSON model

The following table displays the JSON keys and values of the field’s 'API response.

Edit the JSON model with caution

Only edit the JSON model to make changes to the Rich Text field labels. Making abrupt changes can cause conflicts when synchronizing changes with your documents.

type

string (required)

Value must be Color

config

object

Object for the configuration options

config.label

string

The label that shows up for the field in the entry editor

Example JSON configuration

The following JSON defines a Color field:

Copy
"example_color": {
  "type": "Color",
  "config": {
    "label": "Color"
  }
}

API response example

Here is an API response example of a Color field with the API ID of example_color:

Copy
// API response example of a Color field

{
  //...
  "example_color": "#5b295f"
}

Was this article helpful?
Not really
Yes, Thanks

Can't find what you're looking for? Spot an error in the documentation? Get in touch with us on our Community Forum or using the feedback form above.