Skip to content

Instantly share code, notes, and snippets.

@richtabor richtabor/color-classes.css Secret
Last active Jun 20, 2019

Embed
What would you like to do?
.has-black-background-color {
background-color: #2a2a2a;
}
.has-black-color {
background-color: #2a2a2a;
}
.has-gray-background-color {
background-color: #7a7a7a;
}
.has-gray-color {
color: #7a7a7a;
}
<?php
/**
* Add support for custom color palettes in Gutenberg.
*/
function tabor_gutenberg_color_palette() {
add_theme_support(
'editor-color-palette', array(
array(
'name' => esc_html__( 'Black', '@@textdomain' ),
'slug' => 'black',
'color' => '#2a2a2a',
),
array(
'name' => esc_html__( 'Gray', '@@textdomain' ),
'slug' => 'gray',
'color' => '#727477',
)
)
);
}
add_action( 'after_setup_theme', 'tabor_gutenberg_color_palette' );
<?php
// Adds support for editor color palette.
add_theme_support( 'editor-color-palette',
'#2a2a2a',
'#7a7a7a',
);
@ppezier

This comment has been minimized.

Copy link

commented Jun 20, 2019

line 5 of color-classes.css should be color: … instead of background-color: …

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.