Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Log1x/acf-editor-palette
A Gutenberg-like editor palette color picker field for Advanced Custom Fields.
https://github.com/Log1x/acf-editor-palette
acf-field gutenberg wordpress wordpress-plugin
Last synced: about 1 month ago
JSON representation
A Gutenberg-like editor palette color picker field for Advanced Custom Fields.
- Host: GitHub
- URL: https://github.com/Log1x/acf-editor-palette
- Owner: Log1x
- License: mit
- Created: 2020-12-16T01:49:05.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2024-08-06T17:14:23.000Z (5 months ago)
- Last Synced: 2024-11-05T05:10:18.543Z (about 2 months ago)
- Topics: acf-field, gutenberg, wordpress, wordpress-plugin
- Language: PHP
- Homepage: https://github.com/Log1x/acf-editor-palette
- Size: 489 KB
- Stars: 95
- Watchers: 9
- Forks: 14
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
Awesome Lists containing this project
README
# ACF Editor Palette
![Latest Stable Version](https://img.shields.io/packagist/v/log1x/acf-editor-palette?style=flat-square)
![Total Downloads](https://img.shields.io/packagist/dt/log1x/acf-editor-palette?style=flat-square)
![Build Status](https://img.shields.io/github/actions/workflow/status/log1x/acf-editor-palette/compatibility.yml?branch=master&style=flat-square)A Gutenberg-like editor palette color picker field for Advanced Custom Fields.
![Field Example](https://i.imgur.com/bKKU4Sr.gif)
## Features
- Colors are automatically loaded from `theme.json` and/or the editor palette.
- Return format includes the default [palette keys](https://developer.wordpress.org/block-editor/developers/themes/theme-support/) as well as background and text color classes for convenience.
- Default value can optionally be set using the color's slug.
- Colors can optionally be allowed/excluded from the palette.## Requirements
- [PHP](https://secure.php.net/manual/en/install.php) >= 7.2
- [ACF PRO](https://www.advancedcustomfields.com/pro/) >= 5.0## Installation
### Bedrock
Install via Composer:
```bash
$ composer require log1x/acf-editor-palette
```### Manual
Download the [latest release](https://github.com/Log1x/acf-editor-palette/releases/latest) `.zip` and install into `wp-content/plugins`.
## Usage
![Field Group Example](https://i.imgur.com/awXqkFA.png)
```php
^ array:5 [▼
"name" => "Green (500)"
"slug" => "green-500"
"color" => "#0e9f6e"
"text" => "has-text-color has-green-500-color"
"background" => "has-background has-green-500-background-color"
]
```### ACF Composer
If you are on Sage 10 and using my [ACF Composer](https://github.com/log1x/acf-composer) package:
```php
$field
->addField('my_color_field', 'editor_palette')
->setConfig('default_value', 'green-500')
->setConfig('allowed_colors', ['green-500', 'blue-500'])
->setConfig('exclude_colors', ['green-50', 'green-100'])
->setConfig('return_format', 'slug');
```## Bug Reports
If you discover a bug in ACF Editor Palette, please [open an issue](https://github.com/log1x/acf-editor-palette/issues).
## Contributing
Contributing whether it be through PRs, reporting an issue, or suggesting an idea is encouraged and appreciated.
## License
ACF Editor Palette is provided under the [MIT License](LICENSE.md).