Branding SharePoint Modern Sites

Overview

Microsoft is promoting Modern sites in the SharePoint Online platform. Although modern sites has only Teams and Communication templates available, they are responsive in nature and also offer integration with Office 365 groups. In a nutshell, modern sites provides better collaboration than before with the classic SharePoint sites.

The modern team site also seamlessly works with Mobile apps. This increases the usability and offers collaboration on the go.

While browsing SharePoint sites on any device, organizations are very keen to have their own branding (organization logo, color theme, etc.).

What is different with Modern sites in terms of branding?

The classic SharePoint sites offers multiple ways to apply our own branding as below:

  1. Apply an alternate CSS
  2. Create our own custom master page and reference the CSS in it
  3. Create device channels and master pages
  4. Add inline CSS to page using <style></style>

Unfortunately, none of the above options are available with Modern sites.

Microsoft has introduced new alternatives for us to have our custom branding to Modern SharePoint sites called Site Themes. The new Site theme experience allows site owners to apply themes to SharePoint sites.

SharePoint by default offers a few themes for us to choose from.

  1. Open SharePoint modern site
  2. Click Settings menu
  3. Select change the look.
  4. Here, you will see eight available themes as in the below picture. There are eight theme options at the time of writing this article.

    SharePoint

Although the theme options covers most of the common colors, but still these questions remain:

  1. My organization's theme color is not in the list
  2. I can see a closely matching theme, but I would be happy to have the exact theme

The answer to the above questions is to create your own site theme.

Create Our Own Site Theme

Creating a site theme for Modern SharePoint site is simple as compared to writing custom CSS in the past for classic sites.

Microsoft has provided Theme Generator to create our color theme. Theme Generator is an online application or tool which helps us to generate a color palette that we can deploy to our tenant as a site theme.

The tool allows us to select the primary theme color, body background color, and body text color. Once you are ready with your color selection, the Theme Generator offers you 3 options to download your theme

  1. JSON
  2. SASS
  3. PowerShell

PowerShell, although it sounds crazy at this point, helps us to deploy the theme to our tenant and it is the option for us to go for.

Follow the below steps to generate your theme.

  1. Open the Theme Generator (https://developer.microsoft.com/en-us/fabric#/styles/themegenerator)

    SharePoint
  1. Select your colors for primary theme color, body background color, and body text color.
  2. Alternatively, if you already have values for RGB or Hex values type in the values.
  3. Once you are done with the color selection, the output section presents JSON, SASS, and PowerShell options to get the theme.

    SharePoint

  4. We are more interested in the PowerShell option to get the theme deployed to SharePoint.

Deploy the Site Theme

Prerequisites

Below are a couple of prerequisites to install the theme to tenant

  1. SharePoint Online Management Tool.

    You may download it from https://www.microsoft.com/en-in/download/details.aspx?id=35588
  1. SharePoint Admin privileges

Once you have the prerequisites met, follow the below steps:

  1. Open the SharePoint Online Management Shell
  2. Connect to SharePoint tenant using the below command

    Connect-SPOService -Url https://<tenant>-admin.sharepoint.com
  1. Create a PowerShell variable to hold the generated color palette
    1. $customTheme = @{  
    2. "themePrimary" = "#0078d7";  
    3. "themeLighterAlt" = "#eff6fc";  
    4. "themeLighter" = "#deecf9";  
    5. "themeLight" = "#c7e0f4";  
    6. "themeTertiary" = "#71afe5";  
    7. "themeSecondary" = "#2b88d8";  
    8. "themeDarkAlt" = "#106ebe";  
    9. "themeDark" = "#005a9e";  
    10. "themeDarker" = "#004578";  
    11. "neutralLighterAlt" = "#f8f8f8";  
    12. "neutralLighter" = "#f4f4f4";  
    13. "neutralLight" = "#eaeaea";  
    14. "neutralQuaternaryAlt" = "#dadada";  
    15. "neutralQuaternary" = "#d0d0d0";  
    16. "neutralTertiaryAlt" = "#c8c8c8";  
    17. "neutralTertiary" = "#a4a4a9";  
    18. "neutralSecondary" = "#63636a";  
    19. "neutralPrimaryAlt" = "#3b3b3f";  
    20. "neutralPrimary" = "#333336";  
    21. "neutralDark" = "#202022";  
    22. "black" = "#1c1c1d";  
    23. "white" = "#ffffff";  
    24. "primaryBackground" = "#ffffff";  
    25. "primaryText" = "#333336";  
    26. "bodyBackground" = "#ffffff";  
    27. "bodyText" = "#333336";  
    28. "disabledBackground" = "#f4f4f4";  
    29. "disabledText" = "#c8c8c8";  
    30. }  
  1. Run the below command to deploy the theme

    Add-SPOTheme -Name "Custom Cyan" -Palette $customTheme -IsInverted $false –Overwrite

Validate the Theme

Run the command Get-SPOTheme to validate the theme that appears in the list of deployed themes to our tenant.

SharePoint

Apply the Site Theme

  1. Open SharePoint Modern site
  2. Click Settings menu
  3. Select change the look.
  4. Select your custom theme
  5. Click Apply

    SharePoint

Summary

Site Theme is the available option to apply our organization's themes to SharePoint Modern sites. However these themes will not be available on classic sites. In comparison with classic themes, modern themes offer less control to only change the colors. However, it is the only available solution at this point.

I hope this helps.