Levdbas
5/9/2017 - 8:59 PM

custom colors in editor

custom colors in editor

function my_mce4_options($init) {

    $custom_colours = '
        "f77777", "Roze",
        "fddddd", "Lichtroze",
        "000000", "Zwart",
        "808080", "Grijs",
    ';

    // 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', 'my_mce4_options');