Custom Font Colors in WordPress Editor
The WordPress Editor is highly customizable, usually I try to leave it well enough alone but sometimes it makes sense to hook in and make some changes. Here is a simple little code drop that will allow you to customize the colors that you find in the WordPress post editor’s font color. You can add however many colors that you wish here. Note: I’ve removed the default colors completely because I simply do not need them.
This is a great resource if you are building a website for a client with a specific color scheme and would like an easy way for them to change text colors while writing a post (or page).
// change buttons in WYSWIG post editor, edit color palette
function my_mce4_options( $init ) {
$custom_colours = '
"5fc5be", "Light Blue",
"293d70", "Dark Blue",
"576c88", "Light Grey",
"373737", "Dark Grey",
';
$init['textcolor_map'] = '['.$custom_colours.']';
$init['textcolor_rows'] = 1; // decrease to 1 row
return $init;
}
add_filter('tiny_mce_before_init', 'my_mce4_options');
Simply put the above code in your functions.php file and you are off to the races!
Cheers,
Adam