acf-editor-palette icon indicating copy to clipboard operation
acf-editor-palette copied to clipboard

Override Palettes

Open mike-sheppard opened this issue 2 years ago • 2 comments

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,
]);

mike-sheppard avatar Sep 07 '23 11:09 mike-sheppard

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.

Log1x avatar Sep 07 '23 17:09 Log1x

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

mike-sheppard avatar Sep 07 '23 19:09 mike-sheppard