Skip to content

Updating Color Picker default labels

A couple of nice things we’ve added lately to Color Picker add-on. The ability to modify the ‘Pick color’ text when that shows, as it’s sorta hardcoded in at the moment.
Updating Color Picker default labels
Change the default color picker labels

Text field color picker

For the single picker (ie via the text field) you add a PHP filter to your theme functions.

add_filter('gf_colorpicker_action_label', 'my_gf_colorpicker_action_label');
function my_gf_colorpicker_action_label($value) {
   return 'Get Pickin!';
}

‘Other’ radio button field

For the ‘Other’ option in radio button field you add some custom JS either in theme or a HTML field in the form

<script>
window.gf_colorpicker_action_label = function(val){
   return 'Get Pickin!';
}
</script>

Pantone Style

And the ability to modify the ‘Color’ label prefix on the Pantone style. Custom JS again either in theme or a HTML field in the form. For the below, you can also change the value per field (only if it’s a single via text field) simply by giving the field a Placeholder value in the Appearance tab.

<script>
window.gf_colorpicker_pantone_label_prefix = function(val){
   return 'Pick a color';
}
</script>