Skip to content

Instantly share code, notes, and snippets.

@richtabor
Last active June 20, 2019 21:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save richtabor/b6fcb8755a715c373b08c7c8fde5e78f to your computer and use it in GitHub Desktop.
Save richtabor/b6fcb8755a715c373b08c7c8fde5e78f to your computer and use it in GitHub Desktop.
.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
Copy link

ppezier 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