Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save nfsarmento/26ee6c854f07cb46a544b00f8f8bc82b to your computer and use it in GitHub Desktop.
Save nfsarmento/26ee6c854f07cb46a544b00f8f8bc82b to your computer and use it in GitHub Desktop.
function ns_mce4_options($init) {
$custom_colours = '
"3366FF", "Color 1 name",
"CCFFCC", "Color 2 name",
"FFFF00", "Color 3 name",
"99CC00", "Color 4 name",
"FF0000", "Color 5 name",
"FF99CC", "Color 6 name",
"CCFFFF", "Color 7 name"
';
// build colour grid default+custom colors
$init['textcolor_map'] = '['.$custom_colours.']';
// change the number of rows in the grid if the number of colors changes
// 8 swatches per row
$init['textcolor_rows'] = 1;
return $init;
}
add_filter('tiny_mce_before_init', 'ns_mce4_options');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment