SharePoint Online: How to Add New Custom Theme using PowerShell?

Requirement: Create a new Theme in SharePoint Online.

How to create a new color theme in SharePoint Online?

A SharePoint Online theme is a collection of settings that you can use to adjust the appearance of your site. You can use themes to control the colors, fonts, and layout of your site. SharePoint Online Modern sites (Teams, Communications, and Hub sites) provide a set of default themes (Blue, Orange, Red, Purple, Green, and Gray), which you can use to quickly change the look and feel or appearance of your SharePoint sites. In addition, you can create a new theme for a more customized experience for your users.

I’ll show you how to use PowerShell to install themes on SharePoint Online. This is an excellent way for admins, or the site owner themselves, to create their custom SharePoint theme without having to work with CSS at all. How to add a custom theme in SharePoint Online? Creating a custom theme in SharePoint is a quick and easy way to give your site a unique look and feel. Here are the steps to add a custom theme in SharePoint Online:

Step 1: Create New Color Theme in SharePoint Online

Create a new theme in SharePoint Online using this Microsoft fluent UI theme designer: https://aka.ms/themedesigner. Customize and export theme output.

sharepoint online add custom theme powershell

Step 2: Add Custom Theme to SharePoint Online using PowerShell

Once the theme is created using the theme designer, add the theme color to the SharePoint Online tenant using PowerShell. Open SharePoint Online Management Shell or PowerShell ISE as a SharePoint Admin, make sure you change the Admin center URL to your domain and run this script to add a site theme to SharePoint Online using PowerShell:

#Define the color palette
$ThemePalette = @{
"themePrimary" = "#00d492";
"themeLighterAlt" = "#f3fdfa";
"themeLighter" = "#d0f8eb";
"themeLight" = "#a9f2db";
"themeTertiary" = "#5ce5b9";
"themeSecondary" = "#1ad99c";
"themeDarkAlt" = "#00be82";
"themeDark" = "#00a16e";
"themeDarker" = "#007751";
"neutralLighterAlt" = "#f8f8f8";
"neutralLighter" = "#f4f4f4";
"neutralLight" = "#eaeaea";
"neutralQuaternaryAlt" = "#dadada";
"neutralQuaternary" = "#d0d0d0";
"neutralTertiaryAlt" = "#c8c8c8";
"neutralTertiary" = "#ae9e9e";
"neutralSecondary" = "#938181";
"neutralPrimaryAlt" = "#796767";
"neutralPrimary" = "#0f0b0b";
"neutralDark" = "#443636";
"black" = "#2a2020";
"white" = "#ffffff";
}

#Set Admin Center URL
$AdminCenterURL = "https://crescent-admin.sharepoint.com"

#Connect to SharePoint Online - Prompt for credentials
Connect-SPOService -url $AdminCenterURL -Credential (Get-Credential)

#Add new SharePoint Online theme
Add-SPOTheme -Name "Crescent Green" -Palette $ThemePalette -IsInverted $False

This PowerShell adds a site theme to SharePoint Online. If you go to Site settings gear icon >> Change the Look, You’ll find the new color theme listed under “Company Themes”! You can pick the team, and click on the “Apply” button to change the team for your SharePoint site collection.

sharepoint online create new theme

SharePoint Online Add Custom Theme using PnP PowerShell

While SharePoint offers a variety of pre-built themes, you may find that you want to create a custom theme that better suits the needs of your organization. You can add a new theme to SharePoint Online using PnP PowerShell, with Add-PnPTenantTheme cmdlet. Here is how to create a custom theme in SharePoint Online:

#Parameter
$AdminCenterURL = "https://crescent-admin.sharepoint.com"

#Connect to Admin Center
Connect-PnPOnline -Url $AdminCenterURL -Interactive

#Define Theme
$ThemePalette = @{
    "themePrimary" = "#5fc5df";
    "themeLighterAlt" = "#f8fdfe";
    "themeLighter" = "#e3f5fa";
    "themeLight" = "#cbedf5";
    "themeTertiary" = "#9bdbeb";
    "themeSecondary" = "#71cbe2";
    "themeDarkAlt" = "#56b1c8";
    "themeDark" = "#4995a9";
    "themeDarker" = "#356e7c";
    "neutralLighterAlt" = "#f8f8f8";
    "neutralLighter" = "#f4f4f4";
    "neutralLight" = "#eaeaea";
    "neutralQuaternaryAlt" = "#dadada";
    "neutralQuaternary" = "#d0d0d0";
    "neutralTertiaryAlt" = "#c8c8c8";
    "neutralTertiary" = "#d8baba";
    "neutralSecondary" = "#b17f7f";
    "neutralPrimaryAlt" = "#8d5252";
    "neutralPrimary" = "#7e4343";
    "neutralDark" = "#5f3232";
    "black" = "#462525";
    "white" = "#ffffff";
    "primaryBackground" = "#ffffff";
    "primaryText" = "#7e4343";
    "bodyBackground" = "#ffffff";
    "bodyText" = "#7e4343";
    "disabledBackground" = "#f4f4f4";
    "disabledText" = "#c8c8c8";
}

#powershell to add custom theme in sharepoint online 
Add-PnPTenantTheme -Identity "Corporate Theme" -Palette $ThemePalette -IsInverted $False -Overwrite

This creates a custom theme in SharePoint Online. How do I change the default theme in SharePoint online? To apply the theme to the SharePoint Online site, use: How to Apply a Theme in SharePoint Online using PowerShell?

Salaudeen Rajack

Salaudeen Rajack - SharePoint Expert with Two decades of SharePoint Experience. Love to Share my knowledge and experience with the SharePoint community, through real-time articles!

One thought on “SharePoint Online: How to Add New Custom Theme using PowerShell?

  • Thank you for putting together a very simple, straight forward post! Will this work for SharePoint Server 2019? I want to add a custom modern them to my SharePoint 2019 intranet.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *