How to change the theme in Modern Communication Sites

Microsoft has started the roll out of the modern theming capability in Office365. You will have two options available to change the theme for Communication Sites and Modern Team Sites.

Option One is to use the new interface for selecting a theme.

Click on the Site Actions Icon in upper left corner of the screen and select “Change the Look”.

image

Select the theme that you would like and press the “Save” button.

image

Your theme has now been applied.

image

To programmatically apply a theme, create an .spcolor file by using the SharePoint Color Palette Tool. Once you have your .spcolor file, you can use the following Powershell script to deploy your .spcolor file to your modern team site:

# Connect to a previously created Modern Site $cred = Get-Credential Connect-PnPOnline https://[tenant].sharepoint.com/sites/siteurl -Credentials $cred # Apply a custom theme to a Modern Site # First, upload the theme assets Add-PnPFile -Path .\sppnp.spcolor -Folder SiteAssets Add-PnPFile -Path .\sppnp-bg.png -Folder SiteAssets # Second, apply the theme assets to the site $web = Get-PnPWeb $palette = $web.ServerRelativeUrl + "/SiteAssets/sppnp.spcolor" $background = $web.ServerRelativeUrl + "/SiteAssets/sppnp-bg.png" # We use OOTB CSOM operation for this $web.ApplyTheme($palette, [NullString]::Value, $background, $true) $web.Update() # Set timeout as high as possible and execute $web.Context.RequestTimeout = [System.Threading.Timeout]::Infinite $web.Context.ExecuteQuery()

Additional information for customizing of modern sites: 

No Comments