Press "Enter" to skip to content

Slides and scripts from the Ultimate, Modern PnP training day at the European Collaboration Summit in Mainz, 2018

ECS2018 is still going and absolutely awesome fun. Together with the PnP team, we’re having a great time sharing the latest and greatest.

Collab Summit PnP Team

PnP Team Collab Summit

PnP Team Collab Summit

Here are my slides from the Branding session:

And here is my PowerShell script that I used in the demos:
Import-Module Microsoft.Online.SharePoint.PowerShell

 

# Connect to SPO for native cmdlets – radi@M365x957147.onmicrosoft.com
Connect-SpoService Url https://M365x957147-admin.sharepoint.com

 

# Set Hide
Get-SPOHideDefaultThemes #Returns False when default themes are visible
Set-SPOHideDefaultThemes $true

 

# Retrieve a Theme as JSON
Get-SPOTheme Name “Custom 1” | ConvertTo-Json

 

# Remove a theme
Remove-SPOTheme Name “Custom 2”

 

# Set the theme JSON
 
$themeJSON = @{
“themePrimary” = “#800080”;
“themeLighterAlt” = “#FF00FF”;
“themeLighter” = “#FBC0C3”;
“themeLight” = “#808000”;
“themeTertiary” = “#FFA500”;
“themeSecondary” = “#00FF00”;
“themeDarkAlt” = “#00FF00”;
“themeDark” = “#136D80”;
“themeDarker” = “#0000FF”;
“neutralLighterAlt” = “#FFF7D7”;
“neutralLighter” = “#DDEFF8”;
“neutralLight” = “#F2C975”;
“neutralQuaternaryAlt” = “#20B2AA”;
“neutralQuaternary” = “#008B8B”;
“neutralTertiaryAlt” = “#8B0000”;
“neutralTertiary” = “#98FB98”;
“neutralSecondary” = “#DAA520”;
“neutralPrimaryAlt” = “#800000”;
“neutralPrimary” = “#008080”;
“neutralDark” = “#B3AA9B”;
“black” = “#000000”;
“white” = “#ffffff”;
“primaryBackground” = “#ffffff”;
“primaryText” = “#000000”;
“bodyBackground” = “#ffffff”;
“bodyText” = “#000000”;
“disabledBackground” = “#CD9D7C”;
“disabledText” = “#765A4F”;
“blue” = “#0000FF”;
“backgroundImageUri” = “https://M365x957147.sharepoint.com”;
}

 

# Build a Theme Object with a neat for each
$themeObject = New-Object “System.Collections.Generic.Dictionary“2[System.String,System.String]”
$themeJSON.Keys | %{$themeObject.Add($_, $themeJSON[$_])}

 

# Add theme to gallery
Add-SPOTheme Name “Custom 2” Palette $themeObject IsInverted:$false

 

# Automate applying a theme today
Connect-PnPOnline Url https://M365x957147-admin.sharepoint.com

 

# Set up site script – see https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/site-design-overview
$siteScriptJSON = @’
{
    “$schema”: “schema.json”,
    “actions”: [{
            “verb”: “applyTheme”,
            “themeName”: “Custom 2”
        }
    ],
    “bindata”: {},
    “version”: 1
}
‘@
# Add script and design
$siteScript = Add-PnPSiteScript Title “Custom 2” Content $siteScriptJSON
$siteDesign = Add-PnPSiteDesign Title “Custom 2” SiteScriptIds $siteScript.Id WebTemplate TeamSite

 

# Invoke the applying of the site design
Invoke-PnPSiteDesign Identity $siteDesign WebUrl https://M365x957147-admin.sharepoint.com

 

Enjoy and good luck with your ultimate, modern branding!!