With the latest releases of PnP PowerShell in SharePoint 2016 I’ve tried exporting sites ( Get-PnPProvisioningTemplate) and then apply the template to another site Get-PnPProvisioningTemplate. When I do this I noticed that the colours configured within “Site Settings – > Change the look” are being ignored.
I’m quite sure in the past the .spcolor files were exported with the templates.
When I look in the template file I see:
<pnp:ComposedLook Name="" ColorFile="" FontFile="" BackgroundFile="" Version="0" />
It looks like the Composed Look is being ignored.
When I ran this through the debugger I found that the theme doesn’t have a name, and I first thought that this might be the problem.
I then tried using a Publishing site collection in Office 365 and the name of the Theme is now set:
This looks like a bug to me where the name of the theme isn’t always set. Looking deeper into the code I found that the Theme URL is used to match the Current composed to identify which composed look was selected.
Then when I compared how things work in SharePoint 2016 with SharePoint Online I found the answer.
When I look at the composed looks in Office 365 the Current composed look seems to be linked to the selected composed look. For both the Current and Blossom (my source composed look), palette002 is being used.
Within SharePoint 2016 it looks like the Current composed look is a copy of the composed look with its own .spcolor file:
This now means that the code in PnP cannot find what the source of the Current composed look is.
How to get around the problem?
First create a new composed look, then set this to your current composed look. You should now have something like this:
Now PnP PowerShell is able to match things up and the colour scheme is now included in your template.