Color Swatches

Color Swatches
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 1 week ago
Version v1.0.3
Downloads 134
Requires Statamic 2

Rias.be

More by Rias.be

Similar Addons

See All
Add embedded maps or geo data to your content with ease using a drag and drop interface. $2

Cartographer

by Andrew Haine in Fieldtype, Maps, Control Panel, Enhancement
Add embedded maps or geo data to your content with ease using a drag and drop interface.
Manage and configure XML Sitemaps for your Statamic site with support for aliases, automatic cache management and pagination. $19

XML Sitemaps

by Benji Hughes in Enhancement, Utility
Manage and configure XML Sitemaps for your Statamic site with support for aliases, automatic cache management and pagination.
Brings the TinyMCE editor to Statamic as a fieldtype for rich content editing.

TinyMCE Fieldtype

by SOLE in Fieldtype
Brings the TinyMCE editor to Statamic as a fieldtype for rich content editing.