[wordpress插件] ACF RGBA Color PickerACF RGBA拾色器

wordpress 插件 文章 2020-01-27 09:00 615 0 全屏看文

AI助手支持GPT4.0

评分

100

100

描述

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

RGBA颜色选择器是一种在RGBA模式下支持透明色的颜色选择器。

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 acfgba_color_picker/palette filter.

您可以使用 acf / rgba_color_picker / palette 过滤器定义自己的自定义调色板。

In addition, you can define an individual color palette for each field in the field settings.

此外,您可以在字段设置中为每个字段定义一个单独的调色板。

New in version 1.2.0

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).

为防止这种情况,现在将颜色字段显示为几行(每行最多显示10种颜色)。

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)

此插件仅适用于 ACF PRO (5.5.0或更高版本)

.

Localizations

本地化

    • English
    • 英语

    • Deutsch
    • Deutsch

    Custom color palette

    自定义调色板

    Use the acfgba_color_picker/palette filter to create your own standard color palette for the color picker.

    使用 acf / rgba_color_picker / palette 过滤器为颜色选择器创建自己的标准调色板。

    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):

    将这样的代码放入主题functions.php中(您可以使用HEX或RGBA颜色值,也可以将它们混合使用):

      <?php

    function set_acf_rgba_color_picker_palette() {    

    函数set_acf_rgba_color_picker_palette(){    

    $palette = array(        

    $ palette = array(        

    '#FFF',        

    '#FFF',        

    '#0018ff',        

    '#0018ff',        

    '#00FF36',        

    '#00FF36',        

    'rgba(255,168,0,0.7)'    

    'rgba(255,168,0,0.7)'    

    );    

    );    

    return $palette;

    返回$ palette;

    }

    }

    add_filter('acfgba_color_picker/palette', 'set_acf_rgba_color_picker_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() {    

    函数set_acf_rgba_color_picker_palette(){    

    // optional - add colors which are not set in the options page    

    //可选-添加未在选项页面中设置的颜色    

    $palette = array(        

    $ palette = array(        

    '#FFF',        

    '#FFF',        

    '#000'    

    '#000'    

    );    

    );    

    if ( have_rows('YOUR_COLOR_REPEATER_FIELD', 'YOUR_OPTIONS_PAGE') ) {        

    如果(have_rows('YOUR_COLOR_REPEATER_FIELD','YOUR_OPTIONS_PAGE')){        

    while( have_rows('YOUR_COLOR_REPEATER_FIELD', 'YOUR_OPTIONS_PAGE') ) { the_row();            

    while(have_rows('YOUR_COLOR_REPEATER_FIELD','YOUR_OPTIONS_PAGE')){the_row();            

    $palette[] = get_sub_field('YOUR_COLOR_FIELD');        

    $ palette [] = get_sub_field('YOUR_COLOR_FIELD');        

    }    

    }    

    }    

    }    

    return $palette;

    返回$ palette;

    }

    }

    add_filter('acfgba_color_picker/palette', 'set_acf_rgba_color_picker_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:

    如果您不想显示调色板,请将滤镜的返回值设置为false:

      <?php

    add_filter('acfgba_color_picker/palette', '__return_false');

    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.

    将调色板设置为false将禁用并隐藏字段设置中的“调色板”和“隐藏调色板”选项。

安装步骤

    1. Upload the rgba_color_picker folder to your /wp-content/plugins/ directory
    2. rgba_color_picker 文件夹上传到您的 / wp-content / plugins / 目录

    3. Activate the plugin through the ‘Plugins’ menu in WordPress
    4. 通过WordPress中的“插件”菜单激活插件

    5. Done!
    6. 完成!

下载地址

https://downloads.wordpress.org/plugin/acf-rgba-color-picker.1.2.1.zip

https://downloads.wordpress.org/plugin/acf-rgba-color-picker.1.2.1.zip

-EOF-

AI助手支持GPT4.0