“Any customer can have a car painted any color that he wants, so long as it is black.” These were the famous words spoken by Henry Ford in the early 1900s. The quote was related to his Model T car that he wanted to make efficient and accessible to the population. If we fast-forward 100 years and switch gears to SharePoint Online, we too face a similar dilemma with color choices as well. While there is more than one color available to choose from on a SharePoint site, the selection is pretty limited out of the box. In this post, I would like to explain how you can configure and apply a custom theme in SharePoint Online.
Out of the Box Themes
Out of the box, the choices are pretty limited. If you choose Gear Icon > Change the look > Themes, you will notice a palette of just nine color themes.
How to configure and apply a custom theme in SharePoint Online
Important Notes first
- Unfortunately, as of the writing of this post, you have to use a bit of PowerShell to customize the theme according to your brand’s specific colors. This is not possible via the user interface. You know me, I only focus on SharePoint out of the box and try to stay away from PowerShell and things I can’t achieve with a simple click of a mouse. But in order for me to demonstrate this ability to you – we have to roll up our sleeves and get our hands dirty a bit with some PowerShell code. :-)
- The new theme we will create will be an additional theme available for users to choose from (in addition to all the out of the box themes already available)
Step 1: Create a custom theme using the Theme Generator Tool
- Navigate to this URL to generate your new theme
- You can use the Color section to choose your custom colors that match your brand. You will get to see the sample page render in real-time, showing you what the page will look like with new colors. It will also check the page for any accessibility issues and provide you warnings/guidance at the bottom of the screen.
- In my case, my sample page looks like one below
- Next, click Export theme in the upper-right-hand-corner
- On the next screen, choose PowerShell tab, then copy all of the text into a Notepad (we will need it for future steps)
Step 2: Run PowerShell command to install the custom theme
- Download SharePoint Online Management Shell from this link. Follow the prompts to install it on your computer.
- Click on SharePoint Management Shell to start it
- Paste the following command in the prompt: Connect-SPOService -Url https://domain-admin.sharepoint.com (where domain is your SharePoint domain name). In my case, it is sharepointmaven
- You will then need to login, make sure to enter credentials with SharePoint Admin access
- At the command prompt, type in $themepalette = then paste the code you exported in Step 1 (copy from Notepad). It should look like the image below. Press Enter.
- Next, type the following command: Add-SPOTheme -Identity “Name of your theme” -Palette $themepalette -IsInverted $false, where Name of your theme is a theme name you want to give/assign to the theme. NOTE: The name of the theme will be visible to end-users. So make sure to choose something obvious, i.e., Company Theme. In my case, I called mine SPM Theme. Press Enter.
- Mazel Tov! The hard part has been completed, no more code, I promise. We can now change to this new theme in SharePoint.
Step 3: Update the theme on a SharePoint site
Once you pressed Enter after that last command in PowerShell step above, the custom theme was installed/added in SharePoint Online. Now, just navigate to any SharePoint site, and you will see it there (Gear Icon > Change the look > Theme).
And this is what the site looks like after I switched it to my custom theme (if you are a graphic designer, please don’t kill me).
Additional Reading/PowerShell Commands
There are other PowerShell commands you might need to be aware of or even execute in your tenant. For example, if you would like to remove the theme, you created or hide the out of the box themes so that users can’t even choose them. For such cases, I recommend that you check out this Microsoft article to learn more about those additional theme-related PowerShell commands.