{"id":69434,"date":"2025-03-27T11:37:40","date_gmt":"2025-03-27T06:07:40","guid":{"rendered":"https:\/\/www.tothenew.com\/blog\/?p=69434"},"modified":"2025-03-27T15:50:35","modified_gmt":"2025-03-27T10:20:35","slug":"the-rte-color-picker-plugin-in-aem-a-custom-solution-for-speed-and-consistency","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/the-rte-color-picker-plugin-in-aem-a-custom-solution-for-speed-and-consistency\/","title":{"rendered":"The RTE Color Picker Plugin for AEM"},"content":{"rendered":"<p>The Rich Text Editor (commonly known as RTE) in <a href=\"https:\/\/www.tothenew.com\/aem-development-consulting\">Adobe Experience Manager (AEM)<\/a> is a great tool for authoring the text on the page, but it does not have any out of the box (OOTB) color picker plugin. There are few custom solutions available over the internet, however, they often lead to the following common frustrations:<\/p>\n<ol>\n<li><strong>Time to load the dialog.<\/strong><\/li>\n<li><strong>Multiple clicks to apply color.<\/strong><\/li>\n<li><strong>Inconsistency with other Apps.<\/strong><\/li>\n<\/ol>\n<p>So, let\u2019s delve deep into a custom solution for integrating a color palette plugin into RTE to lessen (address) the challenges outlined above.<\/p>\n<div id=\"attachment_69440\" style=\"width: 373px\" class=\"wp-caption aligncenter\"><img aria-describedby=\"caption-attachment-69440\" decoding=\"async\" loading=\"lazy\" class=\"wp-image-69440 size-full\" src=\"https:\/\/www.tothenew.com\/blog\/wp-ttn-blog\/uploads\/2025\/01\/custom-rte-color-plugin-palette.png\" alt=\"custom rte color picker palette\" width=\"363\" height=\"257\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2025\/01\/custom-rte-color-plugin-palette.png 363w, \/blog\/wp-ttn-blog\/uploads\/2025\/01\/custom-rte-color-plugin-palette-300x212.png 300w\" sizes=\"(max-width: 363px) 100vw, 363px\" \/><p id=\"caption-attachment-69440\" class=\"wp-caption-text\">Custom rte color picker palette<\/p><\/div>\n<h3><\/h3>\n<h3>Steps to implement the custom Color Palette in AEM<\/h3>\n<p>First of all, let&#8217;s download the <a href=\"https:\/\/drive.google.com\/file\/d\/1c9G9sLKdP3I7XDmRRog8z2SSB6DIXfMH\/view\">package<\/a>.<\/p>\n<p>You can either install the downloaded package from the CRX package manager and jump to the steps mentioned in section 2, or unzip it to continue with the steps below and then move on to the steps in section 2.<\/p>\n<p>Once the downloaded package is installed or unzipped successfully, it will have the following files:<br \/>\n1. color-picker.css<br \/>\n2. color-picker.js<br \/>\n3. css.txt<br \/>\n4. js.txt<\/p>\n<div id=\"attachment_69520\" style=\"width: 1136px\" class=\"wp-caption aligncenter\"><img aria-describedby=\"caption-attachment-69520\" decoding=\"async\" loading=\"lazy\" class=\"wp-image-69520 size-full\" src=\"https:\/\/www.tothenew.com\/blog\/wp-ttn-blog\/uploads\/2025\/01\/rte-color-picker-files.png\" alt=\"RTE color picker plugin files\" width=\"1126\" height=\"423\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2025\/01\/rte-color-picker-files.png 1126w, \/blog\/wp-ttn-blog\/uploads\/2025\/01\/rte-color-picker-files-300x113.png 300w, \/blog\/wp-ttn-blog\/uploads\/2025\/01\/rte-color-picker-files-1024x385.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2025\/01\/rte-color-picker-files-768x289.png 768w, \/blog\/wp-ttn-blog\/uploads\/2025\/01\/rte-color-picker-files-624x234.png 624w\" sizes=\"(max-width: 1126px) 100vw, 1126px\" \/><p id=\"caption-attachment-69520\" class=\"wp-caption-text\">RTE color picker plugin files<\/p><\/div>\n<p>Steps are divided into two sections. Here, in Section 1, the plugin is developed by extending the box class <strong>CUI.rte.plugins.Plugin,<\/strong> whereas Section 2 is more about the common steps to be followed to add an available plugin to the RTE component toolbar.<\/p>\n<h3><strong>Section 1:- Create a client library for the color picker plugin<\/strong><\/h3>\n<p><strong>1.1<\/strong> Firstly, create a client library with the category <strong>cq.authoring.dialog.all<\/strong> as shown above. (Want to shorten the scope? Give the client library a custom name and add this name to the <strong>extra-clientlibs<\/strong> property of the desired component.)<\/p>\n<p><strong>1.2<\/strong> Now, create a JavaScript file inside the same client library and paste the code from \/apps\/rte-color-picker\/<strong>clientlib\/color-picker.js<\/strong>.<\/p>\n<p><strong>1.3<\/strong> As per standard, create a js.txt file and add the JavaScript file name created in step 1.2 to<strong> js.txt<\/strong>. (As js file is directly created inside the clientlib folder, so there is no need to define the base)<\/p>\n<p><strong>1.4<\/strong> Similarly, create a CSS file inside the client library to put the color palette styling and paste the code from \/apps\/rte-color-picker\/<strong>clientlib\/color-picker.css<\/strong>.<\/p>\n<p><strong>1.5<\/strong> Create a css.txt file under the client library folder and add the CSS file name created in step 1.4 to <strong>css.txt<\/strong>.<\/p>\n<h3>Section 2:- Configure the color picker plugin in the RTE component<\/h3>\n<p>Let&#8217;s follow the steps below to configure the plugin for the component. You may refer documentation of Adobe by clicking the link present in the reference section for more details.<\/p>\n<p><strong>2.1<\/strong> Navigate to the <strong>rtePlugins<\/strong> node of the text component, e.g., \/apps\/ttnretail\/components\/text\/cq:dialog\/content\/items\/tabs\/items\/properties\/items\/columns\/items\/column\/items\/text\/rtePlugins.<\/p>\n<p>Create a node named &#8220;<strong>rte-color-picker<\/strong>&#8221; of primary type <strong>nt:unstructured<\/strong>. Add a property called <strong>features<\/strong> of type String with the value <strong>*<\/strong>.<\/p>\n<div id=\"attachment_69488\" style=\"width: 1143px\" class=\"wp-caption aligncenter\"><img aria-describedby=\"caption-attachment-69488\" decoding=\"async\" loading=\"lazy\" class=\"wp-image-69488 size-full\" src=\"https:\/\/www.tothenew.com\/blog\/wp-ttn-blog\/uploads\/2025\/01\/Aem-rte-plugin-node.png\" alt=\"Aem rte plugin node\" width=\"1133\" height=\"535\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2025\/01\/Aem-rte-plugin-node.png 1133w, \/blog\/wp-ttn-blog\/uploads\/2025\/01\/Aem-rte-plugin-node-300x142.png 300w, \/blog\/wp-ttn-blog\/uploads\/2025\/01\/Aem-rte-plugin-node-1024x484.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2025\/01\/Aem-rte-plugin-node-768x363.png 768w, \/blog\/wp-ttn-blog\/uploads\/2025\/01\/Aem-rte-plugin-node-624x295.png 624w\" sizes=\"(max-width: 1133px) 100vw, 1133px\" \/><p id=\"caption-attachment-69488\" class=\"wp-caption-text\">Aem rte plugin node<\/p><\/div>\n<p><strong>2.2<\/strong> Now, navigate to the &#8220;<strong>inline<\/strong>&#8221; node under <strong>uiSettings<\/strong>, as shown below.<\/p>\n<div id=\"attachment_69491\" style=\"width: 1155px\" class=\"wp-caption aligncenter\"><img aria-describedby=\"caption-attachment-69491\" decoding=\"async\" loading=\"lazy\" class=\"wp-image-69491 size-full\" src=\"https:\/\/www.tothenew.com\/blog\/wp-ttn-blog\/uploads\/2025\/01\/aem-rte-uisettings-inline-node.png\" alt=\"AEM RTE uiSettings inline node\" width=\"1145\" height=\"544\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2025\/01\/aem-rte-uisettings-inline-node.png 1145w, \/blog\/wp-ttn-blog\/uploads\/2025\/01\/aem-rte-uisettings-inline-node-300x143.png 300w, \/blog\/wp-ttn-blog\/uploads\/2025\/01\/aem-rte-uisettings-inline-node-1024x487.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2025\/01\/aem-rte-uisettings-inline-node-768x365.png 768w, \/blog\/wp-ttn-blog\/uploads\/2025\/01\/aem-rte-uisettings-inline-node-624x296.png 624w\" sizes=\"(max-width: 1145px) 100vw, 1145px\" \/><p id=\"caption-attachment-69491\" class=\"wp-caption-text\">AEM RTE uiSettings inline node<\/p><\/div>\n<p><strong>2.3<\/strong> Double-click on the toolbars property, which will display a pop-up as shown below. Click on the plus (+) button and add <strong>rte-color-picker#colorPicker<\/strong>. Then click &#8220;OK&#8221; and save the changes.<\/p>\n<div id=\"attachment_69492\" style=\"width: 1152px\" class=\"wp-caption aligncenter\"><img aria-describedby=\"caption-attachment-69492\" decoding=\"async\" loading=\"lazy\" class=\"wp-image-69492 size-full\" src=\"https:\/\/www.tothenew.com\/blog\/wp-ttn-blog\/uploads\/2025\/01\/edit-toolbar-inline-node.png\" alt=\"Edit toolbar inline node\" width=\"1142\" height=\"542\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2025\/01\/edit-toolbar-inline-node.png 1142w, \/blog\/wp-ttn-blog\/uploads\/2025\/01\/edit-toolbar-inline-node-300x142.png 300w, \/blog\/wp-ttn-blog\/uploads\/2025\/01\/edit-toolbar-inline-node-1024x486.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2025\/01\/edit-toolbar-inline-node-768x364.png 768w, \/blog\/wp-ttn-blog\/uploads\/2025\/01\/edit-toolbar-inline-node-624x296.png 624w\" sizes=\"(max-width: 1142px) 100vw, 1142px\" \/><p id=\"caption-attachment-69492\" class=\"wp-caption-text\">Edit toolbar inline node<\/p><\/div>\n<div class=\"mceTemp\"><\/div>\n<p><strong>2.4<\/strong> (Optionally) Add this plugin to the <strong>dialogFullScreen<\/strong> node as well, if needed in <strong>maximize<\/strong> mode. Navigate to the plugin node inside dialogFullScreen (if the node is not present, take a reference from the OOTB text component to create(overlay) dialogFullScreen under uiSettings\/cui).<\/p>\n<div id=\"attachment_69494\" style=\"width: 1152px\" class=\"wp-caption aligncenter\"><img aria-describedby=\"caption-attachment-69494\" decoding=\"async\" loading=\"lazy\" class=\"wp-image-69494 size-full\" src=\"https:\/\/www.tothenew.com\/blog\/wp-ttn-blog\/uploads\/2025\/01\/aem-rte-dialogFullScreen-node.png\" alt=\"aem rte dialogFullScreen node\" width=\"1142\" height=\"539\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2025\/01\/aem-rte-dialogFullScreen-node.png 1142w, \/blog\/wp-ttn-blog\/uploads\/2025\/01\/aem-rte-dialogFullScreen-node-300x142.png 300w, \/blog\/wp-ttn-blog\/uploads\/2025\/01\/aem-rte-dialogFullScreen-node-1024x483.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2025\/01\/aem-rte-dialogFullScreen-node-768x362.png 768w, \/blog\/wp-ttn-blog\/uploads\/2025\/01\/aem-rte-dialogFullScreen-node-624x295.png 624w\" sizes=\"(max-width: 1142px) 100vw, 1142px\" \/><p id=\"caption-attachment-69494\" class=\"wp-caption-text\">dialogFullScreen<\/p><\/div>\n<p><strong>2.5<\/strong> Add the client library category to the <strong>extraClientlibs<\/strong> property of the component (Optional: only if a custom client library name was given instead of cq.authoring.dialog.all in step <strong>1.1<\/strong>).<\/p>\n<h3>Result:<\/h3>\n<p>Just ensure to save all the changes after each steps.<\/p>\n<p>Now, let&#8217;s author the RTE component on any page to check the color picker plugin. First select some text in the RTE and then click on the plugin icon, it will display the palette with the colors specified in the JavaScript file at line number 7 of the file color-picker.js<\/p>\n<div id=\"attachment_69501\" style=\"width: 1096px\" class=\"wp-caption aligncenter\"><img aria-describedby=\"caption-attachment-69501\" decoding=\"async\" loading=\"lazy\" class=\"wp-image-69501 size-full\" src=\"https:\/\/www.tothenew.com\/blog\/wp-ttn-blog\/uploads\/2025\/01\/rte-color-picker-plugin.png\" alt=\"RTE color picker plugin\" width=\"1086\" height=\"386\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2025\/01\/rte-color-picker-plugin.png 1086w, \/blog\/wp-ttn-blog\/uploads\/2025\/01\/rte-color-picker-plugin-300x107.png 300w, \/blog\/wp-ttn-blog\/uploads\/2025\/01\/rte-color-picker-plugin-1024x364.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2025\/01\/rte-color-picker-plugin-768x273.png 768w, \/blog\/wp-ttn-blog\/uploads\/2025\/01\/rte-color-picker-plugin-624x222.png 624w\" sizes=\"(max-width: 1086px) 100vw, 1086px\" \/><p id=\"caption-attachment-69501\" class=\"wp-caption-text\">RTE color picker<\/p><\/div>\n<p>&nbsp;<\/p>\n<h3>Note:<\/h3>\n<p><strong>i.<\/strong> Congratulations!, plugin is tested. Now, it&#8217;s time to <strong>customise the colors<\/strong> displayed in the palette which can be specific to the project, navigate to <strong>line 7<\/strong> of the <strong>color-picker.js<\/strong> file and modify the array values (add or remove hex color codes as needed) as highlighted in the image below.<\/p>\n<div id=\"attachment_69496\" style=\"width: 1152px\" class=\"wp-caption aligncenter\"><img aria-describedby=\"caption-attachment-69496\" decoding=\"async\" loading=\"lazy\" class=\"wp-image-69496 size-full\" src=\"https:\/\/www.tothenew.com\/blog\/wp-ttn-blog\/uploads\/2025\/01\/rte-color-picker.js_.png\" alt=\"RTE color picker js\" width=\"1142\" height=\"399\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2025\/01\/rte-color-picker.js_.png 1142w, \/blog\/wp-ttn-blog\/uploads\/2025\/01\/rte-color-picker.js_-300x105.png 300w, \/blog\/wp-ttn-blog\/uploads\/2025\/01\/rte-color-picker.js_-1024x358.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2025\/01\/rte-color-picker.js_-768x268.png 768w, \/blog\/wp-ttn-blog\/uploads\/2025\/01\/rte-color-picker.js_-624x218.png 624w\" sizes=\"(max-width: 1142px) 100vw, 1142px\" \/><p id=\"caption-attachment-69496\" class=\"wp-caption-text\">RTE color pciker js<\/p><\/div>\n<p><strong>ii.<\/strong> Last but not least, don\u2019t forget to add the <strong>Handlebars<\/strong> dependency if the plan is to use it in an Experience Fragment.<\/p>\n<p>Feel free to consider customising and optimising this solution so that it suits your needs to streamline the color selection process and enhance content authoring efficiency.<\/p>\n<h3>Reference<\/h3>\n<p><a href=\"https:\/\/experienceleague.adobe.com\/en\/docs\/experience-manager-65\/content\/sites\/administering\/operations\/configure-rich-text-editor-plug-ins\">https:\/\/experienceleague.adobe.com\/en\/docs\/experience-manager-65\/content\/sites\/administering\/operations\/configure-rich-text-editor-plug-ins<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Rich Text Editor (commonly known as RTE) in Adobe Experience Manager (AEM) is a great tool for authoring the text on the page, but it does not have any out of the box (OOTB) color picker plugin. There are few custom solutions available over the internet, however, they often lead to the following common [&hellip;]<\/p>\n","protected":false},"author":1823,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":1049},"categories":[5868],"tags":[5314,7005,7004,7003],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/69434"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/1823"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=69434"}],"version-history":[{"count":47,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/69434\/revisions"}],"predecessor-version":[{"id":71219,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/69434\/revisions\/71219"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=69434"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=69434"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=69434"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}