0

I created composed look with:

  1. Modified oslo.master (removed top links)

  2. New .spcolor file created using SharePoint color palette tool

  3. No image

  4. No font file

Then I applied this composed look. The resulting site did not get impacted by the selected masterpage (modified oslo.master) as the top right links were still present. New color theme was applied.

Then I opened designer and set the master page to the modified oslo page. This resulted in the removal of top right links and the theme was the same as that of selected composed look as desired.

My question is that. What is the purpose of specifying the master page when creating composed look when it really doesn't get applied when you set this look?

1

How did you apply the composed look?

In the browser, you select the masterpage independently of the colors. (The Site Layout dropdown in the left column.) Perhaps you didn't actually change the selected master?

In code, the ApplyTheme() method does not switch the masterpage. It only applies the color and font scheme.

The Composed Looks list is actually just a convenience for the "Change the Look" page accessible from the Site Actions menu. The Office AppModel Samples contains code that replicate this functionality.

  • Yes I had done it via code using applytheme. – variable Mar 21 '14 at 18:25
  • Do I then need to code in the feature activated part to update masterpage also – variable Mar 21 '14 at 18:35
  • You didn't specify where exactly you apply the composed look, so I cannot be certain that feature activated is the best approach. However, in SP2013, the recommendation is to use an app instead of feature receivers. Again, I would refer you to the Office AppModel samples. – Paul Schaeflein Mar 23 '14 at 14:58
  • Composed look is applied to entire site – variable Mar 23 '14 at 20:13
1

Maybe my answer is a bit late, but it might help some else..

I agree with Paul that it depends on how you activate the look.

A composed look consists out of the composed look item (in the themes gallery) as well as the actual resources required for the look (.spfont, .spcolor, .master, etc.).

The composed look item is there so the composed look is displayed when choosing "Change the look". Once a look is applied, the colors and fonts are applied as well as the masterpage is set on the SPWeb. At least this is what happens when you do it via the SharePoint GUI.

If you want to apply the look programmatically, you need to apply the theme as well as set the master page. These are two different steps. You can do this for example by using following code (server object model) in a feature receiver:

public static void ApplyComposedLook(SPWeb web)
{
    // note that to programmatically apply a composed look
    // to a web, we need to set the master page on the web (step 1),
    // as well as apply the theme to the web (step 2)

    // step 1: set master page
    // the master page needs to available on the SPWeb
    // on which we are applying the composed look.
    web.MasterUrl = "urlToMasterPage";
    web.CustomMasterUrl = "urlToMasterPage";
    web.Update();

    // step 2: apply theme
    // the .spcolor and .spfont files need to available
    // on the site collection/root web (this might not be the web on 
    // which the composed look is currently being applied
    SPWeb rootWeb = web.Site.RootWeb;
    SPFile spColor = rootWeb.GetFile("urlToSpColorFile");
    SPFile spFont = rootWeb.GetFile("urlToSpFontFile");

    SPTheme theme = SPTheme.Open("My Theme Name", spColor, spFont);
    theme.ApplyTo(web, true);
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.