Last active
August 18, 2020 15:22
-
-
Save karks88/96c39818af14b0846bd231f005a62a6d to your computer and use it in GitHub Desktop.
Turn off the ability to use the custom color picker in the WordPress Gutenberg editor. Then, define your own custom color palette.
This file contains 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
/* Define Custom Colors on the Front End */ | |
/* white */ | |
.has-white-color { | |
color:#FFFFFF; | |
} | |
.has-white-background-color { | |
background-color:#FFFFFF; | |
} | |
/* black */ | |
.has-black-color { | |
color:#000000; | |
} | |
.has-black-background-color { | |
background-color:#000000; | |
} | |
/* yellow */ | |
.has-yellow-color { | |
color:#ffd000; | |
} | |
.has-yellow-background-color { | |
background-color:#ffd000; | |
} | |
/* blue */ | |
.has-blue-color { | |
color:#347ab7; | |
} | |
.has-blue-background-color { | |
background-color:#347ab7; | |
} | |
/* green */ | |
.has-green-color { | |
color:#2e924d; | |
} | |
.has-green-background-color { | |
background-color:#2e924d; | |
} | |
/* gray */ | |
.has-gray-color { | |
color:#464646; | |
} | |
.has-gray-background-color { | |
background-color:#464646; | |
} | |
/* light gray */ | |
.has-lightgray-color { | |
color:#ebebeb; | |
} | |
.has-lightgray-background-color { | |
background-color:#ebebeb; | |
} |
This file contains 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
// Editor Color Palette | |
add_theme_support( 'editor-color-palette', array( | |
array( | |
'name' => __( 'White', 'textdomain' ), | |
'slug' => 'white', | |
'color' => '#FFFFFF', | |
), | |
array( | |
'name' => __( 'Black', 'textdomain' ), | |
'slug' => 'black', | |
'color' => '#000000', | |
), | |
array( | |
'name' => __( 'Yellow', 'textdomain' ), | |
'slug' => 'yellow', | |
'color' => '#ffd000', | |
), | |
array( | |
'name' => __( 'Blue', 'textdomain' ), | |
'slug' => 'blue', | |
'color' => '#347ab7', | |
), | |
array( | |
'name' => __( 'Green', 'textdomain' ), | |
'slug' => 'green', | |
'color' => '#2e924d', | |
), | |
array( | |
'name' => __( 'Gray', 'textdomain' ), | |
'slug' => 'gray', | |
'color' => '#464646', | |
), | |
array( | |
'name' => __( 'Light Gray', 'textdomain' ), | |
'slug' => 'lightgray', | |
'color' => '#ebebeb', | |
), | |
) ); |
This file contains 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
// Disable Gutenberg Custom Colors | |
add_theme_support( 'disable-custom-colors' ); | |
// Disable Gutenberg Custom Gradients | |
add_theme_support( 'disable-custom-gradients' ); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment