Creating Document Themes with the Office Open XML Formats
Stephanie Krieger, arouet.net
Applies to: Microsoft Office PowerPoint 2007, Microsoft Office Word 2007, Microsoft Office Excel 2007, and the Microsoft Office Open XML Formats. Also applies to Microsoft Office PowerPoint 2008 for Mac, Microsoft Office Word 2008 for Mac, and Microsoft Office Excel 2008 for Mac. (13 printed pages)
Summary: Explore the components of a document theme and examine both best practices and the Open XML necessary to create a complete theme from scratch.
The Construction of a Document Theme
Understanding .thmx Files
Walkthrough: theme1.xml file
Creating a Complete Theme
About the Author
Document themes are one of the most important formatting capabilities in the history of Microsoft Office. What makes them so important and what do developers need to know in order to take advantage of the full value of this functionality? This article explains the elements of a theme, discusses what themes mean to users, and demonstrates what you need to know to create a complete custom theme.
Because you can create many elements of a theme from within Microsoft Office Word, Microsoft Office Excel, or Microsoft Office PowerPoint, and because usability and cohesiveness of the design are as important to themes as the quality of your code, this article looks at both the elements that users can create from within the PowerPoint user interface and the elements that Open XML developers require for creating custom themes.
The Construction of a Document Theme
A document theme is a set of fonts, colors, and graphic effects that you can apply to a Word, Excel, or PowerPoint document with one click. New content that you add to the document then automatically takes on the formatting of the applied theme.
It is important to understand that, whether or not the user applies theme formatting elements in a document, every Word 2007, Excel 2007, and PowerPoint 2007 document contains a theme. Theme colors, fonts, and effects are stored in the document in a document part named theme1.xml.
Additionally, when applied in PowerPoint, a theme includes the slide master, slide layouts, and background styles gallery settings. PowerPoint presentations and templates that use multiple slide masters contain a separate theme document part for each master. When this occurs, the additional parts are numbered consecutively using the naming convention theme#.xml.
Users can combine theme fonts, colors, and effects from different themes and save that combination as their own custom theme from within Word, Excel, or PowerPoint. They can also create and apply custom theme font and theme color sets from within programs in the 2007 Office system (and can create theme colors from within Microsoft Office PowerPoint 2008 for Mac). However, creating custom theme effects requires the use of the Open XML format. Compiling a set of theme files also requires some understanding of Open XML and the file format architecture.
Note that the same themes are available in Word, Excel, and PowerPoint. Whenever you save a theme to a global theme folder location (locations are provided later in this article), it is automatically available in all three programs.
One of the most important capabilities of themes is that the user can instantly swap out the applied theme. That is, when the user applies a new theme to a document, any theme fonts, colors, and effects already applied in the document (as well as backgrounds, layouts, and masters in a PowerPoint document) swap to take on the formatting of the new theme.
So, for example, if you apply a color from the Theme Colors palette, the document records the color palette position rather than the particular color. The specific color value that corresponds to that palette position for the active theme is stored in the theme#.xml part within the document. In the following code sample, notice that the XML value for the fill color of an OfficeArt object is the Accent 1 theme color palette position rather than a specific color value.
<a:solidFill> <a:schemaClr val="accent1" /> </a:solidFill>
Note that, because the swapping capability of a theme is based on the user applying specific gallery positions, the user must apply formatting from the galleries for that formatting to swap. For example, if a user manually applies an RGB color value that exactly matches the active theme's Accent 1 RGB value, the color does not change when a new theme is applied. That is because the user has stored the specific color value in the relevant document part rather than the theme color position.
Purpose of a Theme
From one perspective, the benefit of themes is the ability to mix and match formatting options to easily create a custom look from a wide variety of choices.
However, if you are creating themes as part of a 2007 Office release solution for a company, the more likely scenario is that themes are used to apply the company's visual brand identity. (Visual brand identity (or branding) means, essentially, the approved design and appearance parameters for a company's printed and electronically published materials). One click to apply a theme and you get a coherent set of approved colors, fonts, and graphic effects. Then, it is just one more click to switch the document to the branding for a specific product or division. So, with themes, it is actually easier for the typical user to use the company's approved branding than not to use it. This is an extremely important benefit to larger enterprises in particular, where consistent adherence to the company's branding is often a significant marketing problem.
So, before building a theme, it is a good idea to have a clear picture of how you will use it. Then, you can more easily plan your theme and check theme elements as you complete them to ensure the desired user experience. The remaining topics in this section explain how the theme components work to help you create more effective themes.
In Word and Excel, theme colors, theme fonts, and theme effects are accessible on the Page Layout tab. In PowerPoint, these same elements are accessible on the Design tab as well as the Master tabs (Slide Master, Handout Master, and Notes Master).
Although theme fonts, colors, and effects are part of the theme file for a complete theme (the .thmx file, examined later in this article), they are also typically saved as independent files so that they can appear in the galleries for the specific theme element, as shown in Figure 1.
Figure 1: The Themes group as shown on the Page Layout tab in Word 2007.
Providing galleries for specific theme elements enables the user to create their own combinations. These individual galleries are also useful for common corporate document production requirements, such as when the user needs one color scheme for printed documents and another for documents shared on-screen, while the rest of the theme remains the same.
Although the information about theme colors, fonts, and effects in the subheadings that follow may seem very user-oriented, it is essential information for anyone who is going to create a theme. By understanding how the choices you make manifest in Word, Excel, and PowerPoint when a user applies your theme, you can help to ensure a positive user experience with the themes you create.
Theme colors are a set of 12 colors with specific purposes, as shown in Figure 2. The first ten colors are used to populate the Theme Colors palette, which is accessible anywhere a user can apply color throughout Word, Excel, and PowerPoint. The last two colors are not available in the color palette but are applied automatically as needed, when you add or open a hyperlink.
Figure 2: Theme colors as shown in the Create New Theme Colors dialog box.
The first four colors are used to populate the Background Styles gallery in PowerPoint, as shown later in this article. These colors also determine the font color applied to elements inserted into a PowerPoint presentation. For best practice, Light 1 and Light 2 should be clearly visible on Dark 1 and Dark 2.
The six accent colors are used to format OfficeArt graphics (shapes, SmartArt diagrams, and Excel charts) as well as for table styles in all three programs and WordArt in Excel and PowerPoint. Additionally, the Accent 1 color is the default color for shapes inserted into Excel and PowerPoint as well as for several built-in Word heading styles. For best practice, when possible, all six accent colors should be clearly visible on all Text\Background colors.
The ten colors discussed here populate the Theme Colors palette, shown in Figure 3. The top row of the palette consists of the four text/background colors followed by the six accent colors. The five subsequent rows are populated automatically with tints (for example, lighter variations) and shades (for example, darker variations) of the specified theme colors. These tints and shades are automatic, based on the original color, and cannot be programmatically altered:
For mid-range colors (commonly the accent colors), tints are 80%, 60%, and 40% lighter than the original, and shades are 25% and 50% darker than the original.
Very light colors (typically the light 2 text/background color) use shades of 10%, 25%, 50%, 75%, and 90%.
Very dark colors (typically the dark 2 text/background color) use tints of 90%, 75%, 50%, 25%, and 10%.
White, which is usually used for the Light 1 color position, uses shades of 5%, 15%, 25%, 35%, and 50%.
Black, which is usually used for the Dark 1 color position, uses tints of 50%, 35%, 25%, 15%, and 5%.
Figure 3: The Theme Colors palette
While you technically could set any color you like in any of the 12 theme color positions, remember that specific colors are used for specific purposes, such as populating graphic quick style galleries. A change such as substituting a dark brown for black where you specifically do not want black used anywhere in the theme is likely to work just fine. However, varying from the recommended best practices for visibility discussed earlier could adversely affect the user experience. For example, if you exclude white or black from the theme colors palette, the user will have to take extra steps to apply white or black anywhere in the document.
For best results, check behavior in all locations where a theme is used - such as by inserting a chart on a slide to check its default text color against the slide background or checking the various graphic quick style galleries for visibility of all objects.
Each theme includes a pair of theme fonts, comprised of a designated heading font and body font. For example, the body font is available by default to Excel worksheet cells, Word default text formatting, PowerPoint body text placeholders, and most text in charts and SmartArt graphics. Similarly, the designated heading font is automatically applied to PowerPoint title placeholders as well as some Word heading styles. Although you apply the heading font and body font to some types of content automatically, the user can apply either theme font to any content they choose.
Throughout the various galleries and settings where theme font references appear, you may see the theme fonts listed as FontName(Headings) or FontName(Body), or simply as +Headings or +Body, without the active theme's font name even indicated.
If only one editing language is enabled in Microsoft Office, you see only one pair of theme fonts. And, a theme only requires one pair of theme fonts. However, you can have a separate pair of theme fonts for languages using Latin text fonts, East Asian fonts, and complex script fonts. Additionally, you can specify scripts for particular languages.
You must specify scripts and fonts for languages not enabled on your system by using the Open XML format. Learn how to do this in the walkthrough of the theme1.xml file later in this article.
Theme effects are the primary theme element that puts a theme into the province of developers, because custom theme effects cannot be created from within Microsoft Office.
Theme effects include the fill, line, and effect formatting applied to OfficeArt graphics. And, although separated in the PowerPoint user interface, theme effects as written in the XML also include the Background Styles gallery settings for PowerPoint.
Theme effects are used to populate the following quick styles galleries:
Shape Styles (in PowerPoint and Excel only)
Table Styles (in PowerPoint only; top two rows of the gallery only)
When you create custom theme effects, you control what effects are stored in your theme. However, with the exception of the background styles gallery, the specified effects that populate specific gallery choices is intrinsic to Microsoft Office and cannot be altered programmatically. For this reason, it is important to check all applicable galleries after creating your theme effects, to confirm that no undesirable combinations are available to the user. Learn about how to create theme effects and how those effects translate to the galleries later in this article.
In addition to being powerful formatting functionality you can use across Microsoft Office, themes are also the evolution of PowerPoint design templates. So, when applied in PowerPoint, a theme also includes the slide master, slide layouts, and slide backgrounds for the presentation.
Because slide layouts are customizable in PowerPoint 2007, multiple slide masters are required far less often. This is worth noting because, when your theme is applied to a presentation, every slide master will appear in the Themes gallery and Slide Layouts gallery as a separate theme stored in the file. You can apply different masters to different slides, as in earlier versions of PowerPoint. In PowerPoint 2007, when different masters are applied to specific slides in a presentation or template, the theme fonts, colors, and effects available on those slides are specific to the active slide master's theme.
Considerations for Cross-platform Themes
For those creating themes for use on both the 2007 Office system and Microsoft Office 2008 for Mac, note that themes are cross-platform functionality. That is, you can create a single theme for use on both platforms. When creating themes to use in Office 2008 for Mac, consider the following differences:
The 2007 release of Microsoft Office and Office 2008 for Mac have some differences in available fonts. For your theme to look correct on both platforms, confirm that the theme fonts you intend to include in your theme are available to both your Windows and Mac users.
Some types of shadows manifest differently in the 2007 Office system and Microsoft Office for Mac. To ensure desired results, check the shadows that you include in theme effects, as well as those you apply to objects on slide masters or layouts, on both platforms.
Not all picture file types work equally well on both platforms. However, both PNG and JPG files, which are the recommended image file types for use in themes, do work equally well on both platforms.
In addition to these design considerations, some slight differences in the way theme files are interpreted by the Office programs on the two platforms require checking some elements in the XML when finalizing your theme files. Those checks are explained in the last section of this article.
Understanding .thmx Files
When you explore the ZIP package contents of a .thmx file, as shown in Figure 4, you see the _rels and docProps folders and the [Content_Types].xml file, all of which you know from Open XML Format ZIP packages.
If you are new to working with Open XML, see Additional Resources for some introductory resources on working in the Open XML Formats.
The main document folder for a .thmx file is the theme folder, which contains a subsequent _rels folder and theme folder, as well as slideLayouts and slideMasters folders and a presentation.xml part. If the theme includes any image files (such as images on slide layouts or those used to create theme effects or slide backgrounds), you also see a media folder.
In the second level theme folder, you see the theme1.xml file (which contains the theme color, font, and effect settings for the theme), the themeManager.xml part (which contains just a namespace reference for the theme), the automatically generated thumbnail images for the themes galleries, and a _rels folder.
Figure 4: A .thmx ZIP package
The file themeThumbnail.jpeg is the image that appears in the Themes galleries in Word and Excel; auxiliaryThemeThumbnail.jpeg is the image that appears in the PowerPoint Themes gallery.
You can save a new .thmx file from Word, Excel, or PowerPoint, by using the Save Current Theme option at the bottom of the Themes gallery. When you do this, the set of currently applied theme elements (including your customizations to theme colors, theme fonts, and, if saving your theme from PowerPoint, to the slide master and layouts) is saved as a new theme (a new .thmx file).
The only file in the .thmx ZIP package that requires editing in the XML in order to customize some of its elements is the theme1.xml file.
When you save a new theme from Word or Excel, the slide masters, layouts, and background gallery settings included in the theme are those of the built-in Microsoft Office theme. When creating a complete custom theme, save the theme from PowerPoint to include your customizations to the master and layouts and to generate the thumbnail image for the PowerPoint Themes gallery (which is automatically generated based on the formatting of your theme's Title Slide layout).
Walkthrough: theme1.xml file
The theme1.xml file stores all of the elements of a theme that are applicable across Microsoft Office and the PowerPoint slide background gallery settings. This file contains sections for theme color, font, and effect settings, as shown in the following code sample with the XML markup collapsed for the built-in Paper theme.
To easily view the working results of the theme settings shown in these code samples, all samples provided are from document themes you can easily access. Several samples are from the Paper theme, already referred to, which is one of 20 themes installed when you install the 2007 Office system. These 20 built-in themes are also available in Office 2008 for Mac, along with 30 additional themes created specifically for Mac Office. To demonstrate a variety of design options and settings, additional samples in this article are from themes that I created for Office Online Templates. The name of the applicable theme is provided with each code sample and all of the Office Online themes are available for download. For a link to the Office Online themes, see Additional Resources.
<a:theme name="Paper" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"> <a:themeElements> <a:clrS cheme name="Paper">… <a:fontScheme name="Paper">… <a:fmtScheme name="Paper">… </a:themeElements> </a:objectDefaults /> </a:extraClrSchemeLst /> </a:theme>
Notice that you refer to the theme effects in the XML as the format scheme. In addition to theme effects, the background styles gallery settings are also included in the format scheme XML, and so developers generally consider them to be part of theme effects. However, it is worth noting that the background styles gallery is not treated as part of theme effects within the PowerPoint user interface. That is, if a user applies a different set of theme effects in their presentation but otherwise leaves the active theme intact, the background styles gallery settings do not change.
The following subsections discuss each of the sections of the theme1.xml file. First, however, it's important to mention the Open XML Theme Builder—a free tool created by members of the Microsoft Office product team that provides a user interface for generating all elements of a theme1.xml file.
The Open XML Theme Builder
You can download the Open XML Theme Builder tool from Microsoft Connect. Theme Builder can create a .thmx package, but essentially its purpose is to write the theme1.xml code for you. Using this tool saves you the time of manually writing the theme effects code and enables you to create robust and creative custom themes even if you don't know the XML structure well enough to write the code for the attributes you want to include.
In fact, using the Theme Builder to generate theme effects is an excellent way to learn the Open XML for document themes and much about the Open XML for OfficeArt formatting effects, because you select the attributes you want through the tool and can then read the resulting theme1.xml part that the tool generates from your choices.
Because the options in the Theme Builder map to the theme1.xml file, you will notice that some terminology in this tool differs from the terminology within the Office applications. This is true wherever the terminology in the XML differs from the terminology in the user interface of the Microsoft Office programs. For example, percent transparency for fill and line colors in Word, Excel, and PowerPoint is referred to as the Alpha attribute in the XML. Alpha is the opposite of transparency (i.e., the percent opacity).
Even if you are fluent in Open XML, using the Theme Builder tool is a tremendous timesaver. And, remember that you can always edit the theme1.xml file manually if needed. In fact, a few attributes that you can add to theme effects are not currently available in the tool, such as gradient line color and the miter or beveled line join styles. So, you may want to manually add those in your theme1.xml file after using the Theme Builder. (More information about those attributes is provided later in this article.)
The theme builder does not add a slide master, slide layouts, or thumbnail images to the .thmx package. So, if you start your theme by creating it in the Theme Builder, new presentations based on your theme use the Microsoft Office theme master and layout defaults until you add a slide master and slide layouts. Additionally, a red X appears in place of the thumbnails in the Themes galleries within Word, Excel, and PowerPoint. See Creating a Complete Theme for a recommended best practice process to follow when creating a custom theme from scratch.
Tags in the theme1.xml markup shown across the next several code samples use the letter a as a prefix, indicating OfficeArt elements.
Looking at the following code sample, notice that the tags for the theme color scheme follow what you see in the Create New Theme Colors dialog box within Word, Excel, and PowerPoint. That is, the tags represent the two pairs of dark and light text\background colors, the six accent colors, and the two hyperlink colors.
<a:clrScheme name="Paper"> <a:dk1> <a:sysClr val="windowText" lastClr="000000" /> </a:dk1> <a:lt1> <a:sysClr val="window" lastClr="FFFFFF" /> </a:lt1> <a:dk2> <a:srgbClr val="444D26" /> </a:dk2> <a:lt2> <a:srgbClr val="FEFAC9" /> </a:lt2> <a:accent1> <a:srgbClr val="A5B592" /> </a:accent1> <a:accent2> <a:srgbClr val="F3A447" /> </a:accent2> <a:accent3> <a:srgbClr val="E7BC29" /> </a:accent3> <a:accent4> <a:srgbClr val="D092A7" /> </a:accent4> <a:accent5> <a:srgbClr val="9C85C0" /> </a:accent5> <a:accent6> <a:srgbClr val="809EC2" /> </a:accent6> <a:hlink> <a:srgbClr val="8E58B6" /> </a:hlink> <a:folHlink> <a:srgbClr val="7F6F6F" /> </a:folHlink> </a:clrScheme>
RGB color values stored in a theme color set are stored as hexidecimal values. To edit color values directly in the theme1.xml part, convert the RGB decimal values to hexadecimal values. There are several ways to do this easily. From within Microsoft Office programs, you can either use the DEC2HEX function in Excel or the hex function in Microsoft Visual Basic for Applications (VBA). When displayed as hex values, the red, green, and blue values for an RGB value are shown in order with no breaks between them.
For example, the color RGB(128,198,100) is expressed in hexadecimal values as 80C664. The hexadecimal value for 128 is 80, the hexadecimal value for 198 is C6, and the hexadecimal value for 100 is 64. Any zero value is expressed as 00 in hexadecimal format, as each hexadecimal value uses two characters.
In the preceding code sample, the dark 1 and light 1 color positions use Windows system colors (the a:sysClr tag instead of the a:srgbClr tag). This is standard for the built-in Office 2007 themes, but it is not a requirement for those color palette positions.
Theme fonts must contain one heading and one body font (referred to in the XML markup as major and minor fonts, respectively). The theme font scheme shown in the following code sample is from a US-English installation of Office 2007. For this reason, the font pair identified is for Latin typeface.
If you are creating a theme for users who work in East Asian or complex script languages, add font pairs for those typefaces in the a:ea and a:cs tags. You can include up to three font pairs in your theme fonts but only one pair is required. Note that, even if you add three pairs of fonts, only those font pairs that apply to enabled editing languages appear in Word, Excel, and PowerPoint.
Additionally, you can indicate font scripts to be applied when a user is editing in a specific language, as shown in the following code sample. If a user applies your theme in a language for which you have not specific a font pair or a script, system default fonts are used.
<a:fontScheme name="Paper"> <a:majorFont> <a:latin typeface="Constantia"/> <a:ea typeface=""/> <a:cs typeface=""/> <a:font script="Jpan" typeface="HG明朝E"/> <a:font script="Hang" typeface="궁서"/> <a:font script="Hans" typeface="华文新魏"/> <a:font script="Hant" typeface="標楷體"/> <a:font script="Arab" typeface="Times New Roman"/> <a:font script="Hebr" typeface="Times New Roman"/> <a:font script="Thai" typeface="Browallia New"/> <a:font script="Ethi" typeface="Nyala"/> <a:font script="Beng" typeface="Vrinda"/> <a:font script="Gujr" typeface="Shruti"/> <a:font script="Khmr" typeface="MoolBoran"/> <a:font script="Knda" typeface="Tunga"/> <a:font script="Guru" typeface="Raavi"/> <a:font script="Cans" typeface="Euphemia"/> <a:font script="Cher" typeface="Plantagenet Cherokee"/> <a:font script="Yiii" typeface="Microsoft Yi Baiti"/> <a:font script="Tibt" typeface="Microsoft Himalaya"/> <a:font script="Thaa" typeface="MV Boli"/> <a:font script="Deva" typeface="Mangal"/> <a:font script="Telu" typeface="Gautami"/> <a:font script="Taml" typeface="Latha"/> <a:font script="Syrc" typeface="Estrangelo Edessa"/> <a:font script="Orya" typeface="Kalinga"/> <a:font script="Mlym" typeface="Kartika"/> <a:font script="Laoo" typeface="DokChampa"/> <a:font script="Sinh" typeface="Iskoola Pota"/> <a:font script="Mong" typeface="Mongolian Baiti"/> <a:font script="Viet" typeface="Times New Roman"/> <a:font script="Uigh" typeface="Microsoft Uighur"/> </a:majorFont> <a:minorFont> <a:latin typeface="Constantia"/> <a:ea typeface=""/> <a:cs typeface=""/> <a:font script="Jpan" typeface="HG明朝E"/>… … </a:minorFont> </a:fontScheme>
Theme effects, also referred to as the format scheme (the information within the a:fmtScheme tag, as shown in the fill style code sample that follows), include fill, line, and effect formatting, as well as settings for the Background Styles gallery in PowerPoint.
To create the fill styles, line styles, and effect styles for your theme, specify three sets of options for each, corresponding to subtle, moderate, and intense variations.
If you are designing the theme effects, keep in mind that the subtle, moderate, and intense categories do not actually form three discrete groups of effects. The options you select are used to populate the OfficeArt galleries, combining elements from across subtle, moderate, and intense variations to create a range of styles. For example, the third row of the shape styles gallery combines the intense line style with the subtle fill and effect styles; the SmartArt style named Moderate uses the intense fill style with the moderate effects style.
The following code shows the markup for the fill style list in the built-in theme named Paper. In this example, the subtle fill style is a simple solid fill; both the moderate and intense fill styles are image fills (denoted by the a:blipfill tag). You can use images used for fill styles and background styles and are most often used to provide the appearance of a texture.
<a:fmtScheme name="Paper"> <a:fillStyleLst> <a:solidFill> <a:schemeClr val="phClr"/> </a:solidFill> <a:blipFill> <a:blip r:embed="rId1" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"> <a:duotone> <a:schemeClr val="phClr"> <a:shade val="63000"/> <a:tint val="82000"/> </a:schemeClr> <a:schemeClr val="phClr"> <a:tint val="10000"/> <a:satMod val="400000"/> </a:schemeClr> </a:duotone> </a:blip> <a:tile tx="0" ty="0" sx="40000" sy="40000" flip="none" algn="tl"/> </a:blipFill> <a:blipFill> <a:blip r:embed="rId1" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"> <a:duotone> <a:schemeClr val="phClr"> <a:shade val="40000"/> </a:schemeClr> <a:schemeClr val="phClr"> <a:tint val="42000"/> </a:schemeClr> </a:duotone> </a:blip> <a:tile tx="0" ty="0" sx="40000" sy="40000" flip="none" algn="tl"/> </a:blipFill> </a:fillStyleLst>
Figure 5 shows an example of the Paper theme effects employed in a SmartArt diagram. Notice that the image fill provides a texture that works across the theme colors. You can see the markup for the fill color in the preceding code sample. Recoloring an image fill is done using duotone recoloring (two variations on the same color that contrast to resolve the detail of the image). Nested inside the a:duotone tags that are shown in the fill style markup, you see the following:
The scheme color value is set to placeholder color (the value phClr). This value appears throughout the fill, line, effect, and background styles and indicates that the settings are applied to the theme color applicable for a given style. This allows the same fill, line, and effect styles to populate across the theme colors that appear in the OfficeArt galleries.
Two settings are required for the duotone recoloring. For each, you can apply tints (lighter variations of a color), shades(darker variations of a color), and alpha (percent opacity), as well as hue, saturation, and luminosity. Example of the markup for tint, shade, and saturation are shown in the preceding code example.
Use the a:tile tag shown in the sample markup to tile an image, so that it repeats as needed throughout the fill of an OfficeArt object.
Notice that the numeric values shown in this markup are percent multiplied by 10,000. So, for example, both the moderate and intense fill styles are tiled at 40% height (the sy attribute) and 40% width (the sx attribute).
When you use the Open XML Theme Builder to create your effects, you can enter values for all duotone recoloring options in the Theme Builder interface and test your settings in PowerPoint to see the results.
Figure 5: A SmartArt diagram in the Paper theme
More common than image fills, however, are gradient fills. The following code sample shows an example of the markup for a gradient fill style. Similar to the image fill styles, gradient fill styles use the placeholder color value in order to enable the theme effects to be applied across all applicable theme colors.
The sample gradient shown is the moderate fill style from a theme named Moonlight, which is available for download from Office Online Templates. This is a three-stop, rectangular gradient. Each gradient stop (a:gs tag) can use the same color modification parameters as shown earlier for the image fills, including tint, shade, alpha, hue, saturation, and luminosity.
<a:gradFill rotWithShape="1"> <a:gsLst> <a:gs pos="0"> <a:schemeClr val="phClr"> <a:tint val="90000"/> <a:satMod val="150000"/> </a:schemeClr> </a:gs> <a:gs pos="35000"> <a:schemeClr val="phClr"> <a:tint val="80000"/> <a:satMod val="200000"/> </a:schemeClr> </a:gs> <a:gs pos="100000"> <a:schemeClr val="phClr"> <a:tint val="75000"/> <a:satMod val="250000"/> </a:schemeClr> </a:gs> </a:gsLst> <a:path path="rect"> <a:fillToRect l="100000" t="100000"/> </a:path> </a:gradFill>
The markup shown in the following code sample is for a typical line style list. Notice that there are three line styles indicated (corresponding to subtle, moderate, and intense), each of which is indicated with the a:ln tag.
The line style tag includes attributes for the cap type (style for the end of the line), the compound type (such as single line, shown here), and the alignment of the line relative to the object border.
Nested within each line style tag is the line's fill style information (solid fill in each of the three styles shown in this example). Line fill can use the same color modification properties noted previously for object fill styles, including tint, shade, alpha, hue, saturation, and luminosity.
The a:prstDash tag indicates the dash type; solid in the three styles shown in this markup.
To see the result of the line styles shown here, or to explore the markup for yourself, download the Mod theme from Office Online Templates.
<a:lnStyleLst> <a:ln w="9525" cap="flat" cmpd="sng" algn="ctr"> <a:solidFill> <a:schemeClr val="phClr"> <a:tint val="90000" /> <a:satMod val="105000" /> </a:schemeClr> </a:solidFill> <a:prstDash val="solid" /> </a:ln> <a:ln w="50800" cap="flat" cmpd="sng" algn="ctr"> <a:solidFill> <a:schemeClr val="phClr"> <a:tint val="90000" /> </a:schemeClr> </a:solidFill> <a:prstDash val="solid" /> </a:ln> <a:ln w="76200" cap="flat" cmpd="dbl" algn="ctr"> <a:solidFill> <a:schemeClr val="phClr"> <a:tint val="90000" /> </a:schemeClr> </a:solidFill> <a:prstDash val="solid" /> </a:ln> </a:lnStyleLst>
You can customize all of the settings shown in the preceding markup through the Open XML Theme Builder. Two settings not currently available through that tool, as noted earlier, are the line join type and gradient line fills.
The line join type defaults to round, meaning that lines are gently rounded at the corners of objects. To specify miter (square edge) or bevel (flat edge) corners, add the <a:miter /> or <a:bevel /> tag to the line style.
An example of the markup for a gradient line fill is shown in the following code sample. The gradient stops for line fills use the same format as the gradient fills shown earlier. This example is from the Wildflowers theme, available for download from Office Online Templates.
<a:ln w="38100" cap="flat" cmpd="sng" algn="ctr"> <a:gradFill> <a:gsLst> <a:gs pos="0"> <a:schemeClr val="phClr"/> </a:gs> <a:gs pos="50000"> <a:schemeClr val="phClr"> <a:lumMod val="60000"/> <a:lumOff val="40000"/> </a:schemeClr> </a:gs> <a:gs pos="100000"> <a:schemeClr val="phClr"> <a:lumMod val="20000"/> <a:lumOff val="80000"/> </a:schemeClr> </a:gs> </a:gsLst> <a:lin ang="5400000" scaled="0"/> </a:gradFill> <a:prstDash val="solid"/> </a:ln>
Effect styles can include inner and outer shadows, reflection, glow, soft edges, bevel, and 3-D rotation. The markup shown in the next code sample includes the following settings:
The subtle effect style includes only a white inner shadow.
The moderate effect style includes a larger white inner shadow as well as a reflection.
The intense effect style includes the same reflection as the moderate style as well as a 3-D bevel with a custom surface finish (translucent powder) and custom lighting.
<a:effectStyleLst> <a:effectStyle> <a:effectLst> <a:innerShdw blurRad="50800" dist="25400" dir="13500000"> <a:srgbClr val="FFFFFF"> <a:alpha val="75000"/> </a:srgbClr> </a:innerShdw> </a:effectLst> </a:effectStyle> <a:effectStyle> <a:effectLst> <a:innerShdw blurRad="76200" dist="25400" dir="13500000"> <a:srgbClr val="FFFFFF"> <a:alpha val="75000"/> </a:srgbClr> </a:innerShdw> <a:reflection blurRad="63500" stA="35000" endPos="35000" dist="12700" dir="5400000" sy="-100000" rotWithShape="0"/> </a:effectLst> </a:effectStyle> <a:effectStyle> <a:effectLst> <a:reflection blurRad="63500" stA="35000" endPos="35000" dist="12700" dir="5400000" sy="-100000" rotWithShape="0"/> </a:effectLst> <a:scene3d> <a:camera prst="orthographicFront"> <a:rot lat="0" lon="0" rev="0"/> </a:camera> <a:lightRig rig="balanced" dir="bl"> <a:rot lat="0" lon="0" rev="7800000"/> </a:lightRig> </a:scene3d> <a:sp3d prstMaterial="translucentPowder"> <a:bevelT h="50800"/> </a:sp3d> </a:effectStyle> </a:effectStyleLst>
To see the result of the effect styles shown here, or to explore the markup for yourself, download the Bubbles theme from Office Online Templates.
Understanding Background Styles
Background style options are very similar to the fill style options shown earlier. However, unlike the fill, line, and effect styles for object formatting, the subtle, moderate, and intense background styles you specify do translate exactly to individual entries in the Background Styles gallery.
Each of the three background styles is recolored across the four text\background colors for the theme, creating the twelve background styles gallery positions. The first row of the gallery shows the subtle background style, the second shows the moderate background style, and the third shows the intense background style.
The markup shown in the following code sample is a bit unusual for a background style gallery. As is typical for backgrounds, the subtle style is a simple solid fill and the moderate and intense are gradient fills. However, what is unique here is that some of the gradient stops are specific colors (that is, they will not change for different gallery positions) and some are placeholder colors that are able to change across the given row of the background styles gallery.
Notice that the value phClr is used for placeholder color, but that the accent 5 color (accent5) and the srgbClr color value D8D8D8 (RGB(216,216,216)) are used for some stops. In this theme, the specific colors are used to effect the appearance of sunlight and the placeholder color is used for the balance of the background to provide options across the background styles gallery entries.
If you are designing a complex background gradient, you may want to apply your gradient in PowerPoint, so that you can adjust it and see the results on screen as you do. Then, copy the markup from the PowerPoint slide to which you apply the background and paste it into your theme1.xml file. If you do this, however, be sure to replace gradient stop color values with the phClr value as applicable, to provide options in the background styles gallery.
This markup is from the Air theme, available for download from Office Online Templates. If you download and explore this theme, you see that a few of the backgrounds styles do not appear to have significant differences because of how the gradient manifests. While it is ideal for the background styles gallery to have 12 visually unique choices, this is an example where the design value of the unique theme background takes precedence over the desire to provide as many options as possible. It is the type of decision that may come into play if you are designing a theme for the purpose of enforcing company branding.
<a:bgFillStyleLst> <a:solidFill> <a:schemeClr val="phClr"/> </a:solidFill> <a:gradFill rotWithShape="1"> <a:gsLst> <a:gs pos="0"> <a:schemeClr val="phClr"/> </a:gs> <a:gs pos="52000"> <a:srgbClr val="D8D8D8"/> </a:gs> <a:gs pos="100000"> <a:schemeClr val="phClr"> <a:lumMod val="25000"/> </a:schemeClr> </a:gs> </a:gsLst> <a:path path="circle"> <a:fillToRect t="-80000" r="80000" b="180000"/> </a:path> </a:gradFill> <a:gradFill rotWithShape="1"> <a:gsLst> <a:gs pos="0"> <a:schemeClr val="accent5"/> </a:gs> <a:gs pos="52000"> <a:srgbClr val="D8D8D8"/> </a:gs> <a:gs pos="100000"> <a:schemeClr val="phClr"> <a:lumMod val="25000"/> </a:schemeClr> </a:gs> </a:gsLst> <a:path path="circle"> <a:fillToRect t="-80000" r="80000" b="180000"/> </a:path> </a:gradFill> </a:bgFillStyleLst>
As with fill styles, background styles can also use image fills, and most often do this to provide texture. The following code sample shows the markup for a typical image-based background style (the moderate background style from the built-in Paper theme) with duotone recoloring applied.
<a:blipFill> <a:blip r:embed="rId1" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"> <a:duotone> <a:schemeClr val="phClr"> <a:shade val="55000"/> <a:alpha val="20000"/> </a:schemeClr> <a:schemeClr val="phClr"> <a:tint val="40000"/> <a:shade val="90000"/> <a:satMod val="60000"/> <a:alpha val="20000"/> </a:schemeClr> </a:duotone> </a:blip> <a:tile tx="0" ty="0" sx="58000" sy="38000" flip="none" algn="tl"/> </a:blipFill>
Creating a Complete Theme
The following is the best practice process that I recommend when using the PowerPoint user interface along with the Theme Builder to create your custom theme. Note that you may choose to vary this order based on which theme elements most drive the design for your particular theme. For example, if the slide backgrounds are a substantial part of your design, you may want to create the Background Styles gallery settings in the Theme Builder before customizing your slide master.
This process is recommended for those who are both designing and building the theme, or who need to validate the appearance or usability of the design while building the theme. If all design elements and layout structure have already been determined, and you are constructing the theme by following a prescribed set of guidelines that someone else will test, you may prefer to start in the Theme Builder and then complete your theme in PowerPoint to minimize the steps in the process.
To create your own custom theme
Start your theme in a new, blank PowerPoint presentation. Create your custom theme fonts and theme colors using the options available from the respective galleries on the Design tab. Then customize the slide master (other than the slide backgrounds, which you can apply after creating the Background Styles gallery settings) and the slide layouts. Once you have the bulk of customizations done for the master and layouts, save the theme (to do this from within PowerPoint, on the Design tab, in the Themes group, click to expand the Themes gallery and then click Save Current Theme).
Why this suggested order?
Font selections affect the size, layout, and formatting of placeholders and other content on the slide master and layouts, because fonts can still differ greatly in size at the same point size. For example, text formatted using Arial 12 point is larger than the same text formatted using Times New Roman 12 point.
The colors you apply affect the appearance of content you add to the masters and layouts, and so you can better ensure that your master is adhering to the intended design.
Placing all global design elements on the slide master has long been a best practice for making PowerPoint documents more efficient to create and to use. Because slide layouts can now be individually customized, using the slide master is even more important for efficient creation and ease of use. Also remember that you can select Hide Background Graphics on the Slide Master tab for any layout that should not show elements from the master. This enables you to use the master for content that will be on most, but not all, layouts.
Having the bulk of the design customization for the master and layouts in place before creating theme effects helps you to test how well your theme effect settings work in as close an environment as possible to what the user encounters.
Open the theme in the Open XML Theme Builder and add the fill, line, effect, and background gallery settings that comprise the format scheme in theme1.xml (that is, the Theme Effects and Background Styles gallery settings). You can also adjust theme colors and theme fonts if needed while the theme is open in Theme Builder.
Then use the toolbox icon on the Theme Builder toolbar to test the theme in PowerPoint. Theme Builder generates a test file that shows you how the Shape Styles gallery will look with your selected theme effects and creates one slide with each layout that is currently available in the theme. Apply the appropriate entry(ies) from the Background Styles gallery to the master or layouts as needed and then review the Shape Styles to confirm desired effects.
Insert a SmartArt graphic, an Excel chart, and a PowerPoint table onto slides in the sample presentation so that you can check their respective Quick Style galleries for appearance and behavior.
After you finish the work you need to do in the Theme Builder, you can open the .thmx ZIP package to make any further customizations needed to the theme1.xml file, such as adding formatting attributes to theme effects that are not available in Theme Builder or copying font scripts from another theme. Do not add theme effect attributes to theme1.xml that are not available in Theme Builder until after you finish using the Theme Builder tool. Otherwise, you may experience an error when trying to save your edited theme in Theme Builder.
Double-click your .thmx file to create a new presentation from your theme. If you manually created any slide backgrounds and then copied them to the gallery, confirm that the background styles attached to your master and layouts are selected from the Background Styles gallery as appropriate. Then, resave the theme from PowerPoint to generate the finalized thumbnail images.
Finalizing your Theme
After you complete and test your .thmx file, you have a few steps remaining to finalize your theme.
Check the theme1.xml markup to ensure consistent naming of the theme elements. This is particularly important when your theme is intended for use in Office 2008 for Mac. The theme elements galleries in the 2007 Office system list theme elements by their file name. However, in Office 2008 for Mac, theme elements are listed in the gallery by the name provided in the XML markup.
When you double-click the theme file to create a new presentation, insert one of each type of slide layout. Then, apply a new theme. If elements are left behind on the master or any layout (other than any custom layouts that don't exist in the newly-applied theme), edit the XML to correct this behavior. Objects may be left behind because of the userDrawn attribute that tells PowerPoint the object was added by the user and should not be removed. This functionality is appropriate in a presentation if, for example, a user inserts a logo on a slide master. However, in themes, it can be problematic if the user needs to switch between themes. To correct the issue, search the XML document part for the slide master and each slide layout to locate and delete any instances of the userDrawn="1". Delete only the text shown here in bold for the userDrawn attribute- not the tag in which the attribute resides.
If you find the userDrawn attribute on the master or any layouts, also check the layout itself to ensure that objects added to the layouts were not duplicated when you reapplied the theme during creation.
If you want to have the theme colors, fonts, and effects separately available in each of their respective galleries, create the separate color, font, and effect files, as follows:
Copy the color scheme and font scheme markup into separate XML files to create the theme colors and theme font files. If you are not sure of the structure required, copy an existing theme colors or theme fonts file from one of the built-in themes and paste in the correct markup for your theme. Be sure that the name you indicate in the XML markup matches the file name. Also note that, because these files are named the same and have the same file extension, you must store them in separate folders.
Make a copy of the .thmx file and open its ZIP package. In the top-level theme folder, delete the slideMasters, slideLayouts, and _rels folders. Then, change the file extension to .eftx to create the theme effects file. The reason to delete those folders is simply that the masters and layouts typically contain the bulk of the file size and they are not needed for the .eftx (theme effects) file. The _rels folder at that level contains a .rels file for the slide master, so if you remove the slideMasters folder, you must remove it as well.
For Office 2008 for Mac, theme effects are not separately exposed in their own gallery. So, the .eftx file is not needed on the Mac platform.
When you finished checking the XML, testing the theme in PowerPoint, and creating your theme files, your theme is complete. To save your theme so that it appears in the themes galleries, do one of the following:
For the theme to appear in the custom themes category, save the theme and its respective parts to the set of folders located in one of the following locations:
Windows Vista:C:\Users\[username]\AppData\Roaming\Microsoft\Templates\Document Themes
Windows XP: C:\Documents and Settings\[username]\Application Data\Microsoft\Templates\Document Themes
Mac operating system: The user's My Themes folder.
For the theme to appear in the built-in themes category, save the files to one of the following locations:
Windows Vista or Windows XP: C:\Program Files\Microsoft Office\Document Themes 12
Mac OS: Applications\Microsoft Office 2008\Office\Media\Templates\Office Themes
About the Author
Stephanie Krieger is a professional document consultant, Microsoft Office System MVP, and the author of two books, Advanced Microsoft Office Documents 2007 Edition Inside Out and Microsoft Office Document Designer. Stephanie has extensive experience working with document themes, including building 30 of the themes provided in Office 2008 for Mac and designing and building more than a dozen of the themes available for download from Office Online. Additionally, she wrote the Microsoft Themes SDK, which is available from the Help menu of the Open XML Theme Builder. You can reach Stephanie through her blog, arouet.net.
For more information, see the following resources:
For Open XML Format basics: