Created
July 14, 2022 14:11
-
-
Save kimcoleman/29273f4fe3aa9384373c89824b770020 to your computer and use it in GitHub Desktop.
Add additional colors to the Block Editor color palette.
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 additional colors to the Block Editor color palette. | |
* Update and insert additional colors into the $new_colors array. | |
* | |
*/ | |
function my_custom_editor_color_palette_extended() { | |
$editor_settings = get_block_editor_settings( array(), 'core/edit-post' ); | |
$new_colors = array( | |
array( | |
'name' => __( 'New Color 1', 'textdomain' ), | |
'slug' => 'my-new-color-1', | |
'color' => '#BF665E', | |
), | |
array( | |
'name' => __( 'New Color 2', 'textdomain' ), | |
'slug' => 'my-new-color-2', | |
'color' => '#253659', | |
) | |
); | |
add_theme_support( 'editor-color-palette', array_merge( $editor_settings['colors'], $new_colors ) ); | |
} | |
add_action( 'after_setup_theme', 'my_custom_editor_color_palette_extended', 11 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment