Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Hooking into the ACF color picker and adding the colors
/**
* Add the colors into Iris
*/
add_action( 'acf/input/admin_footer', 'gutenberg_sections_register_acf_color_palette' );
function gutenberg_sections_register_acf_color_palette() {
$color_palette = output_the_colors();
if ( !$color_palette )
return;
?>
<script type="text/javascript">
(function( $ ) {
acf.add_filter( 'color_picker_args', function( args, $field ){
// add the hexadecimal codes here for the colors you want to appear as swatches
args.palettes = <?php echo $color_palette; ?>
// return colors
return args;
});
})(jQuery);
</script>
<?php
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.