Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Customising the CMS /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

restrict colors in HtmlEditorConfig


Go to End


5 Posts   759 Views

Avatar
timo

Community Member, 47 Posts

11 March 2015 at 9:13pm

Edited: 11/03/2015 9:29pm

i have added
$htmlEditorConfig->insertButtonsAfter('formatselect', 'forecolor');
in my CustomLeftAndMainDecorator.
this shows the whole palette of colors in the cms.
How can the color-palette be reduced to some custom colors?
Ive searched the web for hours - no soution found.
thanks.timo.

Avatar
wmk

Community Member, 87 Posts

11 March 2015 at 9:29pm

Hi timo,

depending on how many colors you need i'd use css classes instead of the color attribute.

https://github.com/jonom/silverstripe-tinytidy/blob/master/_config.php has some pretty standard configs to copy/paste which could get you started.

hth, wmk

Avatar
timo

Community Member, 47 Posts

11 March 2015 at 10:12pm

Hi wmk!

Thanks for pointing me to this.
Isnt there a soultion with e.g. a color-array to set somehow?
timo.

Avatar
timo

Community Member, 47 Posts

12 March 2015 at 7:51am

Edited: 12/03/2015 7:51am

in the end i found a solution:

$htmlEditorConfig->insertButtonsAfter('formatselect', 'forecolor');
$htmlEditorConfig->setOption('theme_advanced_text_colors', "FF00FF,FFFF00,00FF00,FF0000,0000FF,000000");
$htmlEditorConfig->setOption('theme_advanced_more_colors', false);

Avatar
wmk

Community Member, 87 Posts

12 March 2015 at 8:00am

Hey timo,

glad you got it working.

Thanks for sharing your solution!