Created
August 10, 2018 14:32
-
-
Save brycejacobson/6421e99e3e67d8be8daa7c295bca4f6c to your computer and use it in GitHub Desktop.
Gutenberg Custom Color Pallet
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 support for custom color palettes in Gutenberg. | |
*/ | |
function meta13_gutenberg_color_palette() | |
{ | |
add_theme_support( | |
'editor-color-palette', | |
array( | |
array( | |
'name' => esc_html__('Light Gray', '@@textdomain'), | |
'slug' => 'lightgray', | |
'color' => '#f7f7f7', | |
), | |
array( | |
'name' => esc_html__('Medium Gray', '@@textdomain'), | |
'slug' => 'mediumgray', | |
'color' => '#58595B', | |
), | |
array( | |
'name' => esc_html__('Dark Gray', '@@textdomain'), | |
'slug' => 'darkmediumgray', | |
'color' => '#231F20', | |
), | |
array( | |
'name' => esc_html__('Black', '@@textdomain'), | |
'slug' => 'black', | |
'color' => '#020202', | |
), | |
array( | |
'name' => esc_html__('White', '@@textdomain'), | |
'slug' => 'white', | |
'color' => '#fefefe', | |
) | |
) | |
); | |
} | |
add_action('after_setup_theme', 'meta13_gutenberg_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
/*------------------------------------*\ | |
#GUTENBERG COLOR PALLET | |
\*------------------------------------*/ | |
// lightgray | |
.has-lightgray-background-color { | |
background-color: $light-gray; | |
} | |
.has-lightgray-color { | |
color: $light-gray; | |
} | |
// mediumgray | |
.has-mediumgray-background-color { | |
background-color: $medium-gray; | |
} | |
.has-mediumgray-color { | |
color: $medium-gray; | |
} | |
// darkgray | |
.has-darkgray-background-color { | |
background-color: $dark-gray; | |
} | |
.has-darkgray-color { | |
color: $dark-gray; | |
} | |
// black | |
.has-black-background-color { | |
background-color: $black; | |
} | |
.has-black-color { | |
color: $black; | |
} | |
// white | |
.has-white-background-color { | |
background-color: $white; | |
} | |
.has-white-color { | |
color: $white; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment