Plugin / ACF RGBA Color Picker

Thomas Meyer

Description

Description

The RGBA Color Picker is a color picker that supports transparency colors in RGBA-Mode.

Custom color palette

The plugin offers the possibility to customize the color palette according to your own wishes. You can define your own custom color palette with the acf/rgba_color_picker/palette filter. In addition, you can define an individual color palette for each field in the field settings.

New in version 1.2.0

If there are a lot of colors for the color palette, the color fields are getting very tiny. To prevent this, the color fields are now displayed in several rows (with a maximum of 10 colors per row). So it is possible to define a lot of colors for the standard palette.

Furthermore, the color picker is now absolutely positioned and this does not shift other elements of the page every time the color picker is opened.

This plugin works only with the ACF PRO (version 5.5.0 or higher).

Localizations

  • English
  • Deutsch

Custom color palette

Use the acf/rgba_color_picker/palette filter to create your own standard color palette for the color picker. Your custom standard color palette, just like the default color palette, can be overridden in the field settings for each field individually.

Fixed color palette

Put a code like this into your themes functions.php (you can use HEX or RGBA color values and can also mix them):

<?php
function set_acf_rgba_color_picker_palette() {
    $palette = array(
        '#FFF',
        '#0018ff',
        '#00FF36',
        'rgba(255,168,0,0.7)'
    );

    return $palette;
}
add_filter('acf/rgba_color_picker/palette', 'set_acf_rgba_color_picker_palette');
?>

Dynamic color palette

If you have an options page where you define some standard colors, create an array from this options like this:

<?php
function set_acf_rgba_color_picker_palette() {
    // optional - add colors which are not set in the options page
    $palette = array(
        '#FFF',
        '#000'
    );

    if ( have_rows('YOUR_COLOR_REPEATER_FIELD', 'YOUR_OPTIONS_PAGE') ) {
        while( have_rows('YOUR_COLOR_REPEATER_FIELD', 'YOUR_OPTIONS_PAGE') ) { the_row();
            $palette[] = get_sub_field('YOUR_COLOR_FIELD');
        }
    }

    return $palette;
}
add_filter('acf/rgba_color_picker/palette', 'set_acf_rgba_color_picker_palette');
?>

This is an example using a repeater field to set the colors; if you store your colors within a string, convert this string into an array.

Hiding color palette

If you dont want to show a color palette set the return value of the filter to false:

<?php
add_filter('acf/rgba_color_picker/palette', '__return_false');
?>

Setting the color palette to false will disable and hide the “Color Palette” and “Hide Color Palette” options in the field settings.

Ratings

5
5 reviews

Rating breakdown

Details Information

Version

1.2.1

First Released

20 Mar, 2017

Total Downloads

10,559

Wordpress Version

4.7 or higher

Tested up to:

4.9.12

Require PHP Version:

-

Tags

Contributors

Languages

DIRECTORY DISCLAIMER

The information provided in this THEME/PLUGIN DIRECTORY is made available for information purposes only, and intended to serve as a resource to enable visitors to select a relevant theme or plugin. wpSocket gives no warranty of any kind, express or implied with regard to the information, including without limitation any warranty that the particular theme or plugin that you select is qualified on your situation.

The information in the individual theme or plugin displayed in the Directory is provided by the owners and contributors themselves. wpSocket gives no warranty as to the accuracy of the information and will not be liable to you for any loss or damage suffered by you as a consequence of your reliance on the information.

Links to respective sites are offered to assist in accessing additional information. The links may be outdated or broken. Connect to outside sites at your own risk. The Theme/Plugin Directory does not endorse the content or accuracy of any listing or external website.

While information is made available, no guarantee is given that the details provided are correct, complete or up-to-date.

wpSocket is not related to the theme or plugin, and also not responsible and expressly disclaims all liability for, damages of any kind, arising out of the use, reference to, or reliance on, any information or business listed throughout our site.

Keep Leading Your Followers!
Share it for them.