Deploy

Add a tenant theme to SharePoint Online

This is example for adding a SharePoint Theme as an option for modern sites in the tenant

Summary

This example adds a tenant theme to the SharePoint. When working with themes, it is recommended to use the Theme Designer to get started and check for accessibility.

Example Theme

powershell

$url = "https://contoso-admin.sharepoint.com"
$themeName = "Demo Branding (Red) PnP"

# -------------------------------------------------------------
# Theme Palette  
# -------------------------------------------------------------

$themePalette = @{
    "themePrimary" = "#b21212";
    "themeLighterAlt" = "#fcf3f3";
    "themeLighter" = "#f3d0d0";
    "themeLight" = "#e8a9a9";
    "themeTertiary" = "#d16060";
    "themeSecondary" = "#bc2727";
    "themeDarkAlt" = "#a11010";
    "themeDark" = "#880e0e";
    "themeDarker" = "#640a0a";
    "neutralLighterAlt" = "#f8f8f8";
    "neutralLighter" = "#f4f4f4";
    "neutralLight" = "#eaeaea";
    "neutralQuaternaryAlt" = "#dadada";
    "neutralQuaternary" = "#d0d0d0";
    "neutralTertiaryAlt" = "#c8c8c8";
    "neutralTertiary" = "#c2c2c2";
    "neutralSecondary" = "#858585";
    "neutralPrimaryAlt" = "#4b4b4b";
    "neutralPrimary" = "#333333";
    "neutralDark" = "#272727";
    "black" = "#1d1d1d";
    "white" = "#ffffff";
    "bodyBackground" = "#ffffff";
    "bodyText" = "#333333";
}

# -------------------------------------------------------------
# Connection  
# -------------------------------------------------------------

Write-Host "Connecting to " $url
Connect-PnPOnline -Url $url -Interactive

# -------------------------------------------------------------
# Apply Theme  
# -------------------------------------------------------------

Add-PnPTenantTheme -Identity $themeName -Palette $themePalette -IsInverted $false -Overwrite

Write-Host "Done! :)" -ForegroundColor Green

Contributors

Author(s)
Paul Bullock
Adam Wójcik
Chandani Prajapati

Disclaimer

THESE SAMPLES ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.

Tool documentation & references

Keep exploring