Last active
August 8, 2022 20:36
-
-
Save MariaJackson1/3f1116f77f46190387ca0960a18ff854 to your computer and use it in GitHub Desktop.
Custom Color Palettes
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
| /* Custom Color Palette Changes Colors in Customizer */ | |
| add_filter( 'generate_default_color_palettes', 'mj_custom_color_palettes' ); | |
| function mj_custom_color_palettes( $palettes ) { | |
| $palettes = array( | |
| '#ffffff', | |
| '#fafafa', | |
| '#e1e1e1', | |
| '#191919', | |
| '#000000', | |
| '#c30dbd', | |
| ); | |
| return $palettes; | |
| } | |
| /* Custom Color Palette Changes Colors in Block Editor */ | |
| add_action( 'after_setup_theme', function() { | |
| add_theme_support( 'editor-color-palette', array( | |
| array( | |
| 'name' => __( 'White' ), | |
| 'slug' => 'white', | |
| 'color' => '#ffffff', | |
| ), | |
| array( | |
| 'name' => __( 'Off White' ), | |
| 'slug' => 'off-white', | |
| 'color' => '#fafafa', | |
| ), | |
| array( | |
| 'name' => __( 'Grey' ), | |
| 'slug' => 'grey', | |
| 'color' => '#e1e1e1', | |
| ), | |
| array( | |
| 'name' => __( 'Dark Grey' ), | |
| 'slug' => 'dark-grey', | |
| 'color' => '#191919', | |
| ), | |
| array( | |
| 'name' => __( 'Black' ), | |
| 'slug' => 'black', | |
| 'color' => '#000000', | |
| ), | |
| array( | |
| 'name' => __( 'Brand Color' ), | |
| 'slug' => 'brand-color', | |
| 'color' => '#c30dbd', | |
| ), | |
| ) ); | |
| } ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment