Templating the Color field
The Color field allows content writers to select a color through a variety of color pickers as well as having the option to manually input a hex value.
This article assumes that you have saved the document object in a variable named document as shown in the Retrieve the document object page.
Retrieve the hex color value
Here's an example of how to retrieve a Color field value. In this case, the Color field has the API ID of color.
const color = document.color;