Skip to content

Instantly share code, notes, and snippets.

@Rubsel
Last active November 12, 2019 20:39
Show Gist options
  • Save Rubsel/2c34b3b136a30b89c3ac91a39518dd0c to your computer and use it in GitHub Desktop.
Save Rubsel/2c34b3b136a30b89c3ac91a39518dd0c to your computer and use it in GitHub Desktop.
Custom Gutenberg colorpicker options
<?php
add_action( 'after_setup_theme', array( $this, 'boa_setup_gutenberg_colorpalette' ) );
add_action( 'after_setup_theme', array( $this, 'boa_gutenberg_disable_custom_colors' ) );
/**
* Disable the custom color picker.
*/
public function boa_gutenberg_disable_custom_colors() {
add_theme_support( 'disable-custom-colors' );
}
/**
* @misc Define BOA Gutenberg colorpalette
*/
public function boa_setup_gutenberg_colorpalette() {
add_theme_support( 'editor-color-palette', array(
array(
'name' => __( 'Boa lightblue', 'customgoodies' ),
'slug' => 'boa-blue-light',
'color' => '#009ee0',
),
array(
'name' => __( 'Boa green', 'customgoodies' ),
'slug' => 'boa-green',
'color' => '#74b342',
),
array(
'name' => __( 'White', 'customgoodies' ),
'slug' => 'boa-white',
'color' => '#fff',
),
array(
'name' => __( 'Black', 'customgoodies' ),
'slug' => 'boa-black',
'color' => '#000',
),
) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment