This tutorial shows guides you through creating a Data model for site theme colors, seasonal content entries for different color palettes, and using the different color themes with content. Instantly change the colors on a Page as in the video below.
- Go to Models.
- Click the + Create New button.
- Name and describe your model. This example uses the name Site theme and the description Colors for site.
- Add a custom field by clicking on the + New Field button.
- Name the new field according to the colors you want to use and set the Type to Color. Here, the color fields are Header, Body copy, Primary, and Secondary. Repeat for each custom field. By setting the Type to Color, you provide a color picker to teammates using the data model to create content entries.
- Click Save.
The following video shows creating a Data model:
The next step is to use the Data model you just made. To have two sets of colors to toggle between, you need two content entries. Follow these instructions to make one content entry for Spring Colors and another content entry for Fall Colors.
- Go to Content.
- Click the + New button.
- Select Site theme.
- Name the new content entry Spring Colors.
- Pick a color for each of the custom fields; Header, Body copy, Primary, and Secondary.
- Click Publish.
- Repeat these steps to create a Fall Colors content entry.
This video shows the process of making the two content entries:
- Go to the Page or Section content entry where you'd like to use the colors from the Data content entry you created in the previous section. This example uses a pre-made Page with some placeholder content.
- Go to the Data tab.
- Click the Builder icon.
- In the dialogue that opens, choose Site theme.
- Click the Pick an Entry button.
- Choose Fall Colors.
- Select a Text block and go to the Style tab. Open the Typography section and select Text Color > Binding.
- Under Get the value for this from, select Site Theme - Data - Header.
Repeat to apply colors to other blocks. In addition to text blocks, the next video includes changing the color of Box blocks. To change the background color of a block as in this video, open the Background section > Fill color > Binding and choose the color.
To switch between Data content entries, such as Fall colors and Spring colors in this example, go to the Data tab, click the pencil icon next to the current Site theme, and select another Site theme. The video below shows toggling between the Fall and Spring color palettes and how the colors on the page switch instantly.
To get even more out of Data models with Builder, check out Integrating CMS Data.
For more general information on Data models, visit Data Models.