Advanced Custom Fields: Color Swatches
ACF Color Swatch Field
★ 76stars
10forks
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/nickforddev/acf-swatch/archive/refs/heads/master.zipFrom the readme
ACF - Color Swatch field add-on
Author: Nick Ford
Tags: acf, acf add-on, color, color swatch, color swatches
Requires at least: 4.0
Tested up to: 5
Description
This is a simple ACF Add-on field allowing the creation of color swatches that behave as radio buttons. This is particularly useful if you want to limit the color options available to the end users, instead of using a color picker field.
This is an add-on for the Advanced Custom Fields
WordPress plugin and will not provide any functionality to WordPress unless Advanced Custom Fields is installed and activated.
The color swatch field is a radio button field, with a few modifications. The syntax for building the choices is the same as a radio button field, in that you may include a key : value pair, or just a single value, each option separated by a line break.
The field expects each line to be a color string, and can interpret all of the possible color formats.
For example, all of the following will produce a bright red swatch:
red
#ff0000
rgb(255,0,0)
rgba(255,0,0, 1)
hsl(0,100%,50%)
hsla(0,100%,50%, 1)
Additionally, if you are using rgb/rgba or hsl/hsla, you may use only the value