Support

Account

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' );