Description

Color Swatches Overview

Instead of providing a user a full color picker, Color Swatches gives an admin the ability to provide a selection of colors for a user to choose from.

Using Color Swatches

Add the fieldtype to your fieldset, you can define multiple colors for a swatch by using a YAML array. You can also set a default color by entering the label.

sections:
  main:
    display: Main
    fields:
      color:
        type: color_swatches
        colors:
          red: '#E3342F'
          orange: '#F6993F'
          green: '#38C172'
          blue-yellow:
            - '#4299E1'
            - '#ECC94B'
        default: blue

Using Color Swatches

You can access both the label and color in your template.

{{ color.label }}
{{ color.value }}
{{ color.value.0 }} #If it's more than one color

Important Links
Details
Released April 16, 2019
Updated 4 months ago
Version v1.0.3
Downloads 229
Requires Statamic 2

Rias.be

More by Rias.be

Similar Addons

See All
Only resize images with Glide when they are within set dimensions.

SafeGlide

by Pixel Primate in Media, Utility, Enhancement, Tag
Only resize images with Glide when they are within set dimensions.
Fields as fields

Field

by Pattern in Fieldtype
Fields as fields
A Statamic fieldtype that gives you a disabled text input

Disabled

by Wout Mager in Fieldtype
A Statamic fieldtype that gives you a disabled text input