Set Default Color and Style Options for Elements of Marketing Pages and Emails – Dynamics 365 Marketing

Per request of Amey Holden, here’s how to pre-define the default colors for objects that users will use to create their email and page templates in Microsoft Dynamics 365 Marketing.

In this example, when a user drags a Text block into a landing page template, we want the default font color to be #404041 and the background color to be #E0E0E0.

Add this code inside the <head> tag of your template’s HTML:

<meta datatype="color" label="Outer Background" name="outer-background" type="xrm/designer/setting" value="#E0E0E0"/>
<meta datatype="color" label="Body Text Color" name="body-text-color" type="xrm/designer/setting" value="#404041"/>
 [data-editorblocktype=Text] { background: /* @outer-background */ #e0e0e0/* @outer-background */ ; color: /* @body-text-color */ #404041/* @body-text-color */ } 

We are using a CSS selector to set a style for every Text block. The text blocks are always divs with an element ‘data-editorblocktype’ that equals “Text”. The CSS above sets a default background color of a light gray (#E0E0E0) and the font color of #404041.

The result is that when a user drags a Text block onto the designer canvas, it will use these styles by default, and the color palette will show our color as the “Automatic” default color:

Published by Matt Wittemann

Sr. Technology Specialist, Microsoft Former 16-time Microsoft MVP

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: