Last active
October 13, 2019 08:14
-
-
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/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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