admin管理员组文章数量:1335854
I need to have the client's theme colors here so he doesn't have to remember the color codes each time he's using them.
Is
is there any way to Add/Remove/Change some colors from the default "Paragraph" block color settings side panel?
Thank you in advance!
I need to have the client's theme colors here so he doesn't have to remember the color codes each time he's using them.
Is
is there any way to Add/Remove/Change some colors from the default "Paragraph" block color settings side panel?
Thank you in advance!
Share Improve this question asked Dec 2, 2019 at 17:17 Razvan CuceuRazvan Cuceu 2482 silver badges14 bronze badges2 Answers
Reset to default 1Rather than adjusting the default palette, you can define (and enforce) a custom palette.
<?php
// Add a custom palette
add_action( 'after_setup_theme', 'wpse_block_color_palette' );
function wpse_block_color_palette() {
add_theme_support(
// Define the colors
'editor-color-palette', array(
// First color - black
array(
'name' => esc_html__( 'Black', 'textdomain' ),
'slug' => 'black',
'color' => '#2a2a2a',
),
// Second color - blue
array(
'name' => esc_html__( 'Blue', 'textdomain' ),
'slug' => 'blue',
'color' => '#0000ff',
)
// And so on and so forth
)
);
}
?>
You'll then want to add styling for the classes they'll generate. The palette applies to any block with core styling, which boils down to "has-(slug)-background-color" and "has-(slug)-color".
.has-black-background-color {
background-color: #000;
}
.has-black-color {
color: #000;
}
.has-blue-background-color {
background-color: #00f;
}
.has-blue-color {
color: #00f;
}
You can use a color palette plugin. Here is a google search for the query WordPress palette
本文标签: Change default colors in paragraph block settings
版权声明:本文标题:Change default colors in paragraph block settings 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742394592a2466666.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论