I'm trying to use the OOTB SharePoint Theme Engine in SharePoint 2013, but no matter what I do, my custom themable css files just don't seem to work.

I deploy my css through a feature. As far as I know and read in blogs, the safest way to make it work is by adding the CSS to the Themable folder in a certain language folder in the Style Library. But this doens't work for me and I'm 100% sure it is the correct language folder I put it in.


.ms-webpart-chrome-title {
    /* [ReplaceColor(themeColor:"SuiteBarBackground")] */ background-color: transparent;


<Module Name="Themable" Path="Themes" RootWebOnly="TRUE" Url="Style Library/en-us/Themable">
    <File Url="devtheme.css" IgnoreIfAlreadyExists="TRUE" Type="GhostableInLibrary" />

Reference in MasterPage

<SharePoint:CssRegistration Name="<% $SPUrl:~SiteCollection/Style Library/~language/Themable/devtheme.css %>" After="corev15.css" runat="server" />

The CSS file is found and read by the engine, but the replacement doesn't happen. What do I do wrong?

  • The file isn't being overwritten do you mean? Or the CSS changes aren't applying properly?
    – Hugh Wood
    Nov 28, 2012 at 15:17
  • @HughWood the CSS changes aren't applied.
    – user2536
    Nov 28, 2012 at 15:22
  • Have you tried using a <link> instead of <SharePoint:CssRegistration> to see if that changes the behavior? Nov 28, 2012 at 15:32

6 Answers 6


If you are creating a Theme for SharePoint 2013, then you should start first with a custom .spcolor or .spfont file and deploy those to the _catalogs/theme/15 folder. In those files, you specify the colors and fonts in the XML, and apply those via the Change the Look page (and also add your custom look to the Composed Looks list).

SharePoint then grabs the colors from the .spcolor file, and uses those values when it does the replacements in the core css files.

If you want to then override the styles that are generated from the theme, you can hard-code your changes into your custom css file and include it like you have done already with the CssRegistration control. I don't know that SharePoint will support replacements in your own custom CSS files.


In order to use SharePoint themes, you need to be using the Seattle masterpage. I'm not sure which masterpage you are using, but any other (even the OOB Oslo one) will not let you use custom themes and such. No one has asked yet, but before we try to dig deep into your feature first let's make sure you're using the masterpage that is compatible with SharePoint theming.

Otherwise, you'd need to do it through custom CSS. Don't know why, but I know that's the truth.

Edit: Sorry, I just really had the time to read through what you're doing. I thought you were trying to create a custom SharePoint Theme to apply via Design Manager. Now that I see you're doing it through code there's a simple solution:

I can't vouch for the URL resolution of your CSS file (that is, if the URL resolves correctly) but I do know where you need to place custom CSS files. Take a look at the sample code below:

<!--MS:<SharePoint:CssLink runat="server" Version="15">-->
    <!--PS: Start Preview-->
        <link href="/_layouts/15/1033/styles/Themable/corev15.css" rel="stylesheet" type="text/css" />
        <link href="/_layouts/15/1033/styles/OLD/Themable/layouts.css" rel="stylesheet" type="text/css" />
        <link href="/_layouts/15/1033/styles/Themable/searchv15.css" rel="stylesheet" type="text/css" />
    <!--PE: End Preview-->
    <!--EH: Start actual CSS Linking -->            
        <link href="/_layouts/15/EH/styles/master.min.css" rel="stylesheet" type="text/css" />
    <!--EH: End -->

That's for the master page, there's another special trick you need for page layouts. The <!--EH --> comments are just ones I put in. They stay as comments in the source code once the masterpage is converted but for work purposes I left them in for anyone else who has to pick this file up.

And honestly, I would deploy it to the file system. This way you can use the file across the entire farm and not have to deploy the feature over and over again to ghost it in libraries. That's my biggest gripe with the new Design Manager. Theming is done on a per site collection level which makes it a huge pain to update.


You can do this using the the sandbox approach.


<Module Name="_catalogsmasterpageSPCcss_" Url="_catalogs/masterpage" RootWebOnly="FALSE" Path="Files\_catalogs\masterpage">
    <File Url="bindtuning.css" Type="GhostableInLibrary" Level="Draft" Path="bindtuning.css">
        <Property Name="ContentTypeId" Value="0x010100C5033D6CFB8447359FB795C8A73A2B1900E5A94EF67A904941AE66C1C189D3E199" />
        <Property Name="FileLeafRef" Value="bindtuning.css" />
        <Property Name="ContentType" Value="Design File" />
        <Property Name="_ModerationStatus" Value="3" />
        <Property Name="FileDirRef" Value="_catalogs/masterpage" />
        <Property Name="FSObjType" Value="0" />

Reference on Masterpage

<SharePoint:CssRegistration name="<%$SPUrl:~sitecollection/_catalogs/masterpage/bindtuning.css%>" runat="server" after="SharepointCssFile" />

You can also open the site with SharePoint designer and put the css file manually under All Files -> _catalogs -> masterpage

  • Does this only work if you put it in the masterpage gallery?
    – user2536
    Apr 16, 2013 at 11:53
  • No, it doesn't need to be specifically in the masterpage gallery, but I recommend you to put the files there. Apr 16, 2013 at 13:25
  • @JoaoFerreira due to the wrong location this won't trigger the theming engine - tags are not replaced this way and so the css is not customizable via .spcolor /* [ReplaceColor(themeColor:"SuiteBarBackground")] */
    – Mx.
    Apr 15, 2015 at 12:50

I had a similar issue in the past - a css file wasn't applied to a page. The behaviour was the following:

  • deployed the file with a new class
  • The class was not applied
  • The IE Developer toolbar showed that the file was loaded, but a old version of it was served to the page
  • downloading the file from the library showed the correct version.

If this is your case, you can resolve the problem by clearing the blob cache for the web application. You can do this from the central admin - that will stop your page from getting an old version of the css.

(Don't know if this can apply to you, posting anyway - hope it helps. If that isn't your case, leave a notice and I will try to delete/edit the answer).

  • This is another reason why I prefer to deploy assets to the file system when applicable (like JS and CSS). Aside from these files being stuck in the site collection, you really don't encounter web application caching. I never have -- just browser caching.
    – EHorodyski
    Apr 10, 2013 at 14:53

Verify have you published the *.css file.


I may be a bit late but maybe this may help others: The SharePoint Theme Engine generates new CSS files from the Themable CSS once it is applied, not on the fly for each request. You always need to apply the Theme after you add/update themable css. This can be done programmatically by calling the SPTheme.ApplyTo method for each web that needs to be updated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.