Last active
November 12, 2019 20:39
-
-
Save Rubsel/2c34b3b136a30b89c3ac91a39518dd0c to your computer and use it in GitHub Desktop.
Custom Gutenberg colorpicker options
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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