Changing SharePoint 2010 Themes with CCS

I struggled with trying to figure out how themes and CCS works but I’ll go over what I learned with you. In our SharePoint 2010 site, we have 1 theme, Graham, and the rest have no themes. What I wanted to do was to modify both the default theme and Graham’s theme a little bit. We noticed a few differences between the 2007 sites and the 2010 sites that may make a cleaner look, but also less organized.

2007 had alternating row colors. 2010 did not have alternating row colors.
2007 had distinct column header colors. 2010 had the distinct column headers only on hover over.
2007 had a darker bar below the WebPart title. 2010’s WebPart bar only was dark on hover over.
2007 had a bold WebPart title. 2010 had a normal font for the WebPart title.

Whats the deal? The only thing I cared about were the WebPart border and the WebPart title (bold and color). Now keep in mind these are the ONLY two themes we care to use. This solution may not work for you, so test diligently.

I used a tool called ThemeBuilder . It’s pretty nice, but there are some things I find I didn’t understand, so I kept it simple. I made the theme I want to publish and I uploaded it on the theme gallery (http://site/_catalogs/theme/Forms/AllItems.aspx). From there I use the different colors and accents that the theme contains in my CCS. I’ll show you.

So the SharePoint Themes Engine will READ comments, which is weird because comments in code are meant to be skipped for rendering. Let’s take a look at what this “comment” really looks like.

/* [ReplaceColor(themeColor:"Accent3")] */ color:#B6B7B8

So this means that any color value that the SharePoint Theme Engine reads on the same line as the comment will replace it with the value of the theme accent or value, in this case the color of “Accent3”. Which is great for us because we can manipulate the themes without having to change the generated CSS’s that the theme makes in the site the theme is on.

Here’s was I did. I opened up (14 hive)\TEMPLATE\LAYOUTS\1033\STYLES\Themable\COREV4.CSS. This is your core CSS file.

I want to change the webpart titles to bold. Change the font-weight from “normal” to “bolder”.

font-weight:normal bolder;

The WebPart border was too light, let’s darken it up. I noticed it’s value was being “tinted” by the SharePoint Theme Engine, so I deleted it.

.ms-WPHeader td,.ms-fakewptitle{
/* [ReplaceColor(themeColor:"Dark2",themeTint:"0.17")] */ border-bottom:1px solid #a9a9a9; /* was EBEBEB */

I deleted the “, themetint:”0.17”. I didn’t notice any change. I think SharePoint will regenerate the CSS associated with the theme upon applying the theme, so lets change the theme, and change it back. Voila! The WebPart Title bottom borders are now darker!

I also want to make my column headers dark like they were in the 2007 platform, and make the hover over even darker. So I added a line to do this in (14 hive)\TEMPLATE\LAYOUTS\1033\STYLES\Themable\COREV4.CSS.

.ms-vh2,.ms-vh,.ms-vh2-nograd,.ms-vh-icon {
/* [ReplaceColor(themeColor:”Light2″)] */ background-color:#d1d1d1; /* added */

and also changed this for the hover over… >, >{
/* [ReplaceColor(themeColor:”Light2-Lighter”)] */ border-color:#e2e2e2;
/* [ReplaceColor(themeColor:”Light2-Medium“)] */ background-color:#a1a1a1; /* was f6f6f6 */

Note: The background-color is for no theme and the ReplaceColor comment will use and replace that color with the accents and colors of the theme upon changing it. If you don’t see your changes, switch to another theme and switch back to regenerate the css files.

I noticed that the hyperlink visited for my webpart headers were default blue (the links are now brown). Maybe I can add those comments to make it work how I want to. Hey, thats a good idea! Let’s change the visited links to brown. I traced the style to the “search.css” file. So let’s navigate there.

.ms-WPHeader a:visited{
/* [ReplaceColor(themeColor:"Hyperlink")] */ color:#3966bf;

I added the comment in bold to change the hyperlink visited to brown. I reset the theme and changed it back in order to regenerate the theme’s CSS files. I checked the page and the hyperlink visited color is now brown!


One thought on “Changing SharePoint 2010 Themes with CCS

Leave a Reply

Fill in your details below or click an icon to log in: Logo

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

Google+ photo

You are commenting using your Google+ 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