Log1x / acf-editor-palette

A Gutenberg-like editor palette color picker field for Advanced Custom Fields.
https://github.com/Log1x/acf-editor-palette
MIT License
95 stars 14 forks source link

Override Palettes #53

Open mike-sheppard opened 1 year ago

mike-sheppard commented 1 year ago

Hey @Log1x would it be possible to expose the Palette $colors via an ACF field setting so we can override them for specific fields?

We have a few elements on a new build where a custom palette is used for Taxonomy/Term accent colors but we don't want to add to the theme color palette that's used everywhere else.

I've been able to append colour using a hacky workaround add_theme_support('editor-color-palette', $tinted_palette); + check if on the correct admin URL, but would be great if we could do something like:

$tinted_palette = [
    [
        'name' => 'Magenta',
        'slug' => 'magenta',
        'color' => '#ff00ff',
    ], 
    ...
];

$terms_options->addField('term_accent_color', 'editor_palette', [
  'colors' => $tinted_palette,
]);
Log1x commented 1 year ago

This is pretty straight forward for the most part – the only annoying part is creating a decent UX for this when you're creating the field type in wp-admin and not programatically.

I'm a little swamped right now but I can try to look into it soon.

mike-sheppard commented 1 year ago

Cool, I'll try to pop a quick PR up that adds the option via PHP config, no idea how to nicely solve the Admin UI aspect either