WordPress.org

Ready to get started?Download WordPress

Forums

How to change color selection in TinyMCE (3 posts)

  1. ninjaboy
    Member
    Posted 7 years ago #

    I have been trying to work out how to change the colours that appear in the text color (colour!) dropdown. I have hacked together a plugin from a couple of other ones to add in other buttons.

    I have found the Javascript that defines the colour when you click 'more colors", but what I actually want to do is control the first set, and limit them to just a few. There is no need for the popup colour picker, just the ability to contol the first set of colour chips that comes up.

    I have looked for ages on Google and on the TinyMCE site and forums, but just can't work this one out... please help!

  2. ninjaboy
    Member
    Posted 7 years ago #

    Incidentally, I found this on their site:

    http://wiki.moxiecode.com/index.php/TinyMCE:Configuration/theme_advanced_text_colors

    Option: theme_advanced_text_colors

    This option controls the colors shown in the palette of colors displayed by the text color button. The default is a palette of 40 colors. It should contain a comma separated list of color values to be presented.

    tinyMCE.init({
    	...
    	theme_advanced_text_colors : "FF00FF,FFFF00,000000"
    });

    How do I implement this in my plugin...any ideas?? I'd ideally not like to have to hack to core code to make upgrades easier.

  3. ninjaboy
    Member
    Posted 7 years ago #

    OK, after sweating over this for ages I now have a fix, but now I need to know how to implement this in a plugin!

    In the file wp-includes/js/tinymce/tiny_mce_config.php I have added two lines into the initArray = section

    theme_advanced_text_colors : "FF00FF,FFFF00,000000",
    theme_advanced_more_colors : false,

    How do I get this bundled into a plugin, rather than hard coding it into the core files, which will obviously have to be updated every time I update WP... not ideal!

    PLEASE - Someone help!!

Topic Closed

This topic has been closed to new replies.

About this Topic