Skip to content

Instantly share code, notes, and snippets.

@beingtree
Last active October 14, 2017 20:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save beingtree/dcc97aeaaa0dac1f1774c9d4afdb8a14 to your computer and use it in GitHub Desktop.
Save beingtree/dcc97aeaaa0dac1f1774c9d4afdb8a14 to your computer and use it in GitHub Desktop.
<?php
/* .... some other theme functions ... */
/* Custom Default Colors for WP and 18 Tags Colorpickers */
function theme_name_color_palettes() {
if(wp_script_is('wp-color-picker', 'enqueued') && wp_script_is('lib-alpha-color-picker', 'enqueued')){
?>
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery.wp.wpColorPicker.prototype.options = {
palettes: ['#ffffff', '#000000', '#bdd54a', '#b0dfe4', '#f192bc']
};
jQuery.lib.libColorPicker.prototype.options = {
palettes: ['#ffffff', '#000000', '#bdd54a', '#b0dfe4', '#f192bc']
};
});
</script>
<?php
}
}
add_action('admin_footer', 'theme_name_color_palettes');
add_action('customize_controls_print_scripts', 'theme_name_color_palettes');
/* .... possibly more theme functions ... */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment