最好的方法是公开数据,以便对其进行修改。您可以通过添加筛选器来完成此操作:
add_theme_support( \'editor-color-palette\', apply_filters( \'themeLangDomain_editor_color_palette_args\', array(
array(
\'name\' => __( \'Strong magenta\', \'themeLangDomain\' ),
\'slug\' => \'strong-magenta\',
\'color\' => \'#a156b4\',
),
array(
\'name\' => __( \'Light grayish magenta\', \'themeLangDomain\' ),
\'slug\' => \'light-grayish-magenta\',
\'color\' => \'#d0a5db\',
),
) ) );
然后子主题或插件可以使用
add_filter
修改中的数据
themeLangDomain_editor_color_palette_arg
:
add_filter( \'themeLangDomain_editor_color_palette_args\', function( $palette ) {
$palette[] = array(
\'name\' => __( \'Black\', \'themeLangDomain\' ),
\'slug\' => \'black\',
\'color\' => \'#000000\',
);
return $palette;
} );