Color fields allow the selection of a custom color.
Predefined themes can be defined in enact/config/color-palettes.php, an example color-palettes.php could look like this:
<?php return Array( 'Default Theme' => Array('#225378', '#1695A3', '|', '#ACF0F2', '#F3FFE2', '|', '#EB7F00'), 'Black And White with Transparency' => Array('rgba(0,0,0,.5)', 'rgba(250,250,250,.5)'), );
Colors can be defined as hex, rgb, rgba, hsg, or even text. A bar | represents a line break.
If the field has been set to required then the entry will not be update-able until a color has been selected. Setting a default color is considered a selection and an error will not be shown in that instance.
Access your color fields via the handle you set for the field.
<div style='background-color: {{ entry.yourFieldHandle }}'>Nice background color!</div>
Test if the value was set
{% if entry.yourFieldHandle %} <p>Color was set and it was {{ entry.yourFieldHandle }}</p> {% else %} <p>Color was not set!</p> {% endif %}