Skip to content

Instantly share code, notes, and snippets.

@mishterk
Last active October 13, 2019 08:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mishterk/e4839b08de2ac0f09e62ebfe619fbcb5 to your computer and use it in GitHub Desktop.
Save mishterk/e4839b08de2ac0f09e62ebfe619fbcb5 to your computer and use it in GitHub Desktop.
How to set a custom colour pallet for ACF's colour picker field. For more info see https://philkurth.com.au/tips/how-to-customize-the-colour-palette-for-acfs-colour-picker-field/
<?php
add_action( 'admin_footer', function () {
?>
<script>
if (window.acf) {
acf.addFilter('color_picker_args', function (args, $field) {
args.palettes = [
'#E6D8D5',
'#E75274',
'#F9FEFD',
'#58C2B5',
];
return args;
});
}
</script>
<?php
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment