Skip to content

Instantly share code, notes, and snippets.

@besimhu
Created March 15, 2015 16:00
Show Gist options
  • Save besimhu/fd4aaa096ceefdf6addf to your computer and use it in GitHub Desktop.
Save besimhu/fd4aaa096ceefdf6addf to your computer and use it in GitHub Desktop.
You can add custom colors to the TINYMCE editor, and this is especially handy if you want clients to stick to their color palette. Please be aware that this function gets rid of all colors and just adds in your selection.
// TINYMCE Options
function my_mce4_options( $init ) {
$custom_colours = '
"db1e34", "Color Name", "222c64", "Color Name Two"
';
$init['textcolor_map'] = '['.$custom_colours.']';
$init['textcolor_rows'] = 6;
return $init;
}
add_filter('tiny_mce_before_init', 'my_mce4_options');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment