Basic SharePoint branding with themes and CSS

Written By: Knox Cameron -- 5/31/2011 -- join -- contribute -- (2937) comments -- printer friendly version

Rating: Rate --

Categories: Configurations, Design, Programming and Customizations, SharePoint 2010, SharePoint Foundation 2010

< Prev - 1 | 2 | 3 | 4 | - Next > | Become a paid author


Themes in SharePoint 2010 work differently from 2007, and there is no migration path. They do less (for example, they can no longer apply a custom background image or custom CSS styles), but are much easier to build. In 2010, they focus purely on color, and the idea is that they allow you to manage color independent of page layout.

Themes in SharePoint 2010 are linked to themes in Microsoft Office on the desktop. Until Office 2003, each of the main components of the Office suite managed colors in different ways, but from Office 2007 onwards they have standardized on the color model that originated in PowerPoint.

Any Excel developer will tell you that this represents a "dumbing down" from previous versions! In particular, you can only specify a very limited range of colors in the theme. Office will then generate additional shades based on an internal algorithm over which you have no control. If you have corporate design standards that specify particular approved shades, there is no way to provide these in the interface or prevent a user selecting non-approved shades.

But from a SharePoint perspective, the system works pretty well, and by creating custom style sheets you can get more control under the covers than you can get on the desktop.

Here, we will look at how the appearance of a SharePoint is changed when you apply a theme, which is poorly documented in general. We will then look at how you can create a theme using PowerPoint and apply it to SharePoint.

  • Note that, although themes are available in SharePoint Foundation, they are not applied for anonymous users. As a partial workaround, you can use a content editor web part to manually put in a reference to the theme stylesheet. See Customizing the blog - part 1 for more details.

What is in a theme?

A theme consists of 12 colors and two fonts, as you can see in the Site theme page in site settings (the "Customize Theme" section is displayed by SharePoint Server when you are at the top level site in a site collection):

Site theme page from SharePoint site settings

The colors are:

  • text/background dark 1 and 2, and light 1 and 2;
  • accents 1 to 6;
  •  hyperlink and followed hyperlink.

The fonts are a heading font and a body font.

Office generates an additional 5 shades of each color (Lightest, Lighter, Medium, Darker, Darkest) which are shown in the themes user interface. When you edit text, the color selector shows the 10 base colors (excluding the hyperlink ones) plus the additional 5 shades of each, as well as some standard (non-theme) colors.

Colour selector when editing text

Where are these colors and fonts used?

To find out, I created a truly horrible theme with garish colors, so I could see where they were used. Here is the theme, with annotations on how the colors are used on that page:

Theme page annotated with colors used

Having created a further 48 shades based on the 12 you specified in the theme, Microsoft goes on to create even more shades on the fly using the 'shade' function to darken or the 'tint' function to lighten one of the 12 base colors. They also recolor images to create gradients.

Contrary to what you might expect, 'shade 20%' darkens a lot whereas 'shade 80%' only darkens a little. Similarly 'tint 20%' lightens a lot and 'tint 80%' lightens a little. Effectively, the percentage indicates closeness to the original color.

It quickly becomes obvious that the color shading is too subtle to pick up visually. I used the Internet Explorer developer tools to identify the CSS classes being applied to the content, and a cross checked those with the various style sheets installed by SharePoint.

In these screen shots, I am only calling out the main examples of color usage. There are dozens of other places in the user interface where theme colors are used - far too many to attempt to list them all here. Many of them are subtle details, such as top, left, right and bottom borders of a selected menu item.

We could summarize the overall effect as:

  • Lightened Light1 on Dark2 for the very top bar
  • Dark1 and Dark2 on Light2 for the ribbon bar and left navigation area
  • Accent1 for the selected item in the global navigation
  • Shades of Dark1 on Light1 for the main body

If we look at the home page of a team site, it's generally the same, although with some Dark2 in the body, and some use of the other accents and shading.

Team site home page with theme annotations

A few things to note here:

  • The default heading in the page content uses the rich text editor "Colored Heading 1" style, even though that style is not available in the editor when you edit the page - if you edited the page and deleted the heading, I don't know how you would ever get it back!
  • The other listed styles are the ones available from the Styles drop-down in the rich text editor. If you don't select a style, you get the default body style, which is different from "Normal".
  • A couple of elements on the page (the search box and some default content) seem to have hard-coded color values that aren't linked to the theme.
  • No use is made of the fonts incorporated in the theme.

Now let's look at a publishing site, which is using the "nightandday.master" master page.

Home page of a publishing site with theme annotations

Here, for the first time, the fonts from the theme are being used. The heading font is used for the page heading (h1 style) and the body font is the default font for text in the body of the page.

However there are even more elements not themed, including the background color of the main page body (white), the default text color (very dark grey) and the font of the default content. There is probably an assumption that if you are building a publishing site, you are more likely to invest in detailed customization, including custom master pages and style sheets, rather than simply applying a theme. In fact, unless your company is called "AdventureWorks", you are going to need to at least replace the logo image in the site.

As you edit content on a publishing page, you will come across more use of theme colors in the rich text editor. There are four table styles which use Light1, Accent1 and Dark1.

Table styles annotated for themes

There is also an additional set of styles called "Markup Styles" that provide two sets of heading styles, 4 callout styles, horizontal rule and a paragraph style.

Markup styles annotated for theme

Heading level 1 is the only style that uses the heading font from the theme. The 'colored heading' styles use various accent colors. However, the four 'callout' styles use fixed colors.

Color and font usage summary

When you are selecting colors and fonts for a theme, you need to be aware of how SharePoint generally uses them:

  • Dark1, Dark2, Hyperlink and Followed Hyperlink are used for most text, including some shaded variations
  • Light1 and Light2 are used for most backgrounds, including some shaded variations
  • Accent1 is used frequently for highlighting, both as a text color and as a background
  • Accents 2 to 6 are used very little
  • The heading font is only used for level 1 headings in publishing pages
  • The body font is used for body content on publishing pages, but most other text remains in a system font

Creating a theme

You can create a theme using Word, Excel or PowerPoint, 2007 or 2010. The process is:

  • From the Design tab in PowerPoint (or the Page Layout tab in Word or Excel), use the Colors drop down in the Themes group to select one of the existing color schemes that is similar to what you want

Color scheme gallery in PowerPoint

  • Select "Create New Theme Colors..." from the bottom of the same drop down. This will show you the currently selected colors and allow you to select any of them for editing.

Colour scheme editor in PowerPoint

  • You can use the "More Colors..." option to specify an exact value for a color in RGB

Color selector in PowerPoint

  • One issue you may encounter is that Office uses decimal values between 0 and 255 for each of the red, green and blue components of the color. If you have been given color values to use on a web site, they will typically be in hexadecimal format, something like "#FA9A00" for an orange, which is how they would be specified in a CSS stylesheet. Fortunately, the calculator in Windows 7 can do hex conversions. To convert this code to decimal for Office, you would:
    • Open Windows calculator, and select Programmer from the View menu
    • Select the Hex radio button on the left
    • Enter the first two digits after the #, which is the value for red in hex notation; in this case FA
    • Select the Dec radio button on the left to see what this value is in decimal, in this case 250. Select 250 as the value for red in PowerPoint.
    • Repeat this process for 9A to find that the value for green should be 154. Hopefully, it is obvious that the value for blue should be 0!
    • Alternatively, a search engine will find you many pages on the net that will do RGB hexadecimal to decimal conversions. These will be much faster to use if you have more than one or two conversions to do, as you can convert all three values in one go.
  • Once you have the colors right, give your color scheme a name at the bottom of the dialog, and press save. Note that this has only saved your colors - you haven't yet created a theme.
  • If you need to go back and edit your colors, you can right click the scheme in the Colors drop-down in PowerPoint, Word or Excel, and select "Edit...".
  • You also need to select the heading and body fonts for your theme. To do this, follow a similar process using the Fonts drop-down, immediately below the Colors drop-down.
  • Once you have the colors and fonts right for your theme, you can save it as a .thmx file. To do this, click the "More" down arrow at the right of the theme gallery in PowerPoint (or just open the theme gallery in Word or Excel).

More button in PowerPoint themes gallery

  • At the bottom of the expanded theme gallery, select Save Current Theme...
  • By default, it will save into C:\Users\{your user name}\AppData\Roaming\Microsoft\Templates\Document Themes. That is where the theme should go if you want to be able to use it in Office on your desktop, but you can also browse to a location where you will be able to find it more easily for uploading to SharePoint.

Applying the theme to SharePoint

You can upload the theme into SharePoint through the site administration web pages. To do this:

  • Go to the top-level site in your site collection
    • Themes are stored in a gallery there for the whole site collection
  • Select Site Actions > Site Settings
  • Under Galleries, select Themes
  • Select the Documents tab in the ribbon, then select Upload Document

Upload theme to gallery

  • Upload the .thmx file you saved from PowerPoint
  • Once the file is uploaded, go to Site Actions > Site Settings and select Site Theme under Look and Feel
  • Your new theme will appear in the list so you can select it and apply it to the current site (and optionally sub-sites as well)

< Prev - 1 | 2 | 3 | 4 | - Next >

Learn more about SharePoint

Sponsor Information

Copyright (c) 2010-2017 Edgewood Solutions, LLC All rights reserved
privacy | disclaimer | copyright | advertise | contribute | feedback | about
Some names and products listed are the registered trademarks of their respective owners. |