SBB
SBB

Reputation: 63

Customizing color palette of tinymce

How do i go on about customizing a color palette in tinymce to look like the image below?

image

I am using tinymce v5. Since the textcolor plugin is now enabled by default, my old code for customizing the palette is nt working anymore.

I would appreciate any idea

Upvotes: 2

Views: 2725

Answers (1)

James Johnson
James Johnson

Reputation: 356

The colors can be set using the color_map setting. It is a list of paired hexadecimal colors without the leading # followed by a name.

Here is an example:

tinymce.init({
  selector: 'textarea',  // change this value according to your HTML
  toolbar: 'forecolor backcolor',
  color_map: [
    '000000', 'Black',
    '808080', 'Gray',
    'FFFFFF', 'White',
    'FF0000', 'Red',
    'FFFF00', 'Yellow',
    '008000', 'Green',
    '0000FF', 'Blue'
  ]
});

Upvotes: 3

Related Questions