Home Forums Feature Requests Color Picker Default Value


Color Picker Default Value

  • Hi. I have set the default value for a color picker and it works great. The problem (and it’s only a niggle really) is that the user can’t revert back to the original default color. They can hit the clear button and through the implementation of the field I can allow the default color to be used, however it would be nice for the default color to appear back in the color picker. It seems logical to have that on the site I’m creating. Could this be built in or does anyone know of a work around for this?


  • Hi @cannon303

    Hmm.. ACF uses the builtin datepicker in WordPress which is Iris by Automattic.:

    There’s the palette option which you could use. However (I just noticed this) there is no filter hook for the color pickers options. I’m going to make a feature request for this in the development github repo.. Hopefully Elliot will add this in pretty fast.

    In the meantime the only thing I can think of is to reinitialize the colorpicker yourself with a custom script in wp admin.
    You can use this snippet for adding inline javascript:

    function my_acf_input_admin_footer() {
    <script type="text/javascript">
    (function($) {
    	// JS here
    add_action('acf/input/admin_footer', 'my_acf_input_admin_footer');
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Color Picker Default Value’ is closed to new replies.