Home › Forums › General Issues › Iris Color Picker Palette Problem › Reply To: Iris Color Picker Palette Problem
Updated method posted at https://www.ractoon.com/2014/11/acf5-pro-color-picker-custom-palettes
The method below runs into performance issues when combined with repeater/flexible content fields.
This method has worked for me:
function my_acf_admin_head() {
echo "
<script>
(function($){
acf.add_action('ready append', function() {
acf.get_fields({ type : 'color_picker'}).each(function() {
$(this).iris({
palettes: ['#efefef', '#0093d0', '#235164', '#203051', '#1b2945', '#181717'],
change: function(event, ui) {
$(this).parents('.wp-picker-container').find('.wp-color-result').css('background-color', ui.color.toString());
}
});
});
});
})(jQuery);
</script>
";
}
add_action( 'acf/input/admin_head', 'my_acf_admin_head' );
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.