Creating and Deploying a Custom Theme in SharePoint Online

If you’re moving from classic SharePoint to modern, sooner or later (I’m guessing sooner), you’ll want some control over the colors and fonts in your modern sites. I think the main reason people decide they need to do something about this is the random colors which are assigned to each new site as you create it.

Looking at just a handful of modern sites in our Sympraxis tenant, you can see what I mean.

If you’re in a classic site, you’re going to have weird half and half theming options. There are two different theming engines.

  • Classic Change the look options – which means the old type of theme (the ones which include Sea Monster!).
  • Modern themes in the modern Change the look options. (The modern Change the look options are in mid-upgrade to add new options [Navigation and Footer], but you won’t see those options in a classic site.)

themes do get applied to classic pages, so it you have a mix, you should use a
modern theme.

You can create a custom modern theme using the Theme Generator tool. Unfortuantely, there are only three “slots” you can change in the tool:

  • Primary Theme Color
  • Body Text Color
  • Body Background Color

The code you need is generated in a box in the page and you can copy it out when you are done.

What I’d love to see is two enhancements: the ability to enter more color codes to change “slots” beyond the three above, and the ability to paste existing theme code back into the tool to tweak further.

The trick then is to deploy the theme you have generated. You can certainly use a Site Script, but for a one-off, it probably makes more sense to use a little Powershell.

You do need to be a SharePoint Admin for this to work because you have to connect to to deploy the custom theme.

The theme
is then available to all sites, but
you have to apply it in the Change the look settings.

The Powershell for this is really simple, and any admin worth their salt should be ably to follow any of the three posts below with no problem – it’s just three lines. If you create a theme in the Theme Generator, you can just give your admin the theme settings. The easiest format for them to deal with would probably be from the Powershell tab.

Connect-SPOService -Url

$themepalette = @{
"themePrimary" = "#3395cf";
"themeLighterAlt" = "#f5fafd";
"themeLighter" = "#daecf7";
"themeLight" = "#baddf0";
"themeTertiary" = "#7cbde2";
"themeSecondary" = "#48a1d4";
"themeDarkAlt" = "#2e87ba";
"themeDark" = "#27729d";
"themeDarker" = "#1d5474";
"neutralLighterAlt" = "#f8f8f8";
"neutralLighter" = "#f4f4f4";
"neutralLight" = "#eaeaea";
"neutralQuaternaryAlt" = "#dadada";
"neutralQuaternary" = "#d0d0d0";
"neutralTertiaryAlt" = "#c8c8c8";
"neutralTertiary" = "#b9bec9";
"neutralSecondary" = "#7c8392";
"neutralPrimaryAlt" = "#4a5160";
"neutralPrimary" = "#363c49";
"neutralDark" = "#2a2e38";
"black" = "#1f2229";
"white" = "#ffffff";

Add-SPOTheme -Identity "My Company Theme" -Palette $themepalette -IsInverted $false



of these posts walk you through creating a custom theme with the Theme
Generator and deploying it to a site using the SharePoint Online Management Shell (Powershell). They are
all good, and each takes a slightly different slant.

from Marc D Anderson’s Blog