Customized color theme in SharePoint online

In SharePoint online we do have some default themes which we can customize with some default colors. But for many organizations out there they wish to use their own company / organization colors. And this is an easy task for us to fix.

In Microsoft Fluent UI Theme Designer the we can try out colors and see how it will look like in SharePoint Online. There is a preview of menu buttons, text, background, dropdown menu, checkboxes, toggles, buttons, links and much more.
When we are satisfied with our colors we simply press Export theme button in top right corner and we will choose PowerShell to export.

We copy the code and we will put the code into a variable called $palette.

$palette = @{
"themePrimary" = "#0078d4";
.........

Next we will type the command that creates the theme in SharePoint Online. We can give our theme a name behind the “Identity” parameter and we will choose our theme colors behind the “Palette” parameter. If we have a dark background and a light foreground we can choose to set the parameter “IsInverted” to $true but for me I will have a light background so the parameter will be set to $false

Add-SPOTheme -Identity "AC colors" -Palette $palette -IsInverted $false

PowerShell – Connect to SharePoint Online with MFA

On the first time running PowerShell commands against SharePoint Online we need to install a module which includes all commands against SharePoint. Simply we need to install a command library to our computer. If you already have done some PowerShell work against SharePoint Online you can skip this step.

Start PowerShell.exe with running it as administrator on your computer and run the command:

Install-Module -Name Microsoft.Online.SharePoint.PowerShell
You need to accept the NuGet provider and that you download the module from a Untrusted repository (even though it is Microsoft who created the module)

The command library for SharePoint is now installed, but we need to load the library to PowerShell to be able to use the SharePoint commands.

Import-Module Microsoft.Online.Sharepoint.Powershell

Next we need to connect and authenticate to our SharePoint Online instance. Since, at least, every administrator account should be enabled for MFA (all user accounts should be enabled for MFA in your organization, but that is another topic) this type of connection supports MFA.
To connect to our instance of SharePoint we need our admin url, simply copy your SharePoint url and add “-admin” behind your tenant name. My tenant.

Connect-SPOService -Url https://yourtenantname-admin.sharepoint.com
When connecting a sign-in window will pop up and we will simply login.

Add, modify and remove custom themes

Add a custom theme
Time to add our theme to SharePoint Online. Let’s put our $palette code and the Add-SPOTheme command togheter and run it in our PowerShell window. Code will look like:

$palette = @{
"themePrimary" = "#0078d4";
"themeLighterAlt" = "#eff6fc";
"themeLighter" = "#deecf9";
"themeLight" = "#c7e0f4";
"themeTertiary" = "#71afe5";
"themeSecondary" = "#2b88d8";
"themeDarkAlt" = "#106ebe";
"themeDark" = "#005a9e";
"themeDarker" = "#004578";
"neutralLighterAlt" = "#faf9f8";
"neutralLighter" = "#f3f2f1";
"neutralLight" = "#edebe9";
"neutralQuaternaryAlt" = "#e1dfdd";
"neutralQuaternary" = "#d0d0d0";
"neutralTertiaryAlt" = "#c8c6c4";
"neutralTertiary" = "#a19f9d";
"neutralSecondary" = "#605e5c";
"neutralPrimaryAlt" = "#3b3a39";
"neutralPrimary" = "#323130";
"neutralDark" = "#201f1e";
"black" = "#000000";
"white" = "#ffffff";
}
Add-SPOTheme -Identity "AC colors" -Palette $palette -IsInverted $false

If we go to a site in our SharePoint site we will now see a new theme.

Click on the cogwheel top right corner, click “Change the look” and click “Theme”

Modify a custom theme
If we wish to modify/update colors in a theme we already created we simply add the Overwrite parameter to our Add-SPOTheme command

$palette = @{
"themePrimary" = "#0078d4";
"themeLighterAlt" = "#eff6fc";
"themeLighter" = "#deecf9";
"themeLight" = "#c7e0f4";
"themeTertiary" = "#71afe5";
"themeSecondary" = "#2b88d8";
"themeDarkAlt" = "#106ebe";
"themeDark" = "#005a9e";
"themeDarker" = "#004578";
"neutralLighterAlt" = "#faf9f8";
"neutralLighter" = "#f3f2f1";
"neutralLight" = "#edebe9";
"neutralQuaternaryAlt" = "#e1dfdd";
"neutralQuaternary" = "#d0d0d0";
"neutralTertiaryAlt" = "#c8c6c4";
"neutralTertiary" = "#a19f9d";
"neutralSecondary" = "#605e5c";
"neutralPrimaryAlt" = "#3b3a39";
"neutralPrimary" = "#323130";
"neutralDark" = "#201f1e";
"black" = "#000000";
"white" = "#ffffff";
}
Add-SPOTheme -Identity "AC colors" -Palette $palette -IsInverted $false -Overwrite

Remove a custom theme
If we want to remove a custom theme we simply use the Remove-SPOTheme command and type the name of the custom theme we want to remove behind the Identity parameter.

Remove-SPOTheme -Identity "AC colors"

Leave a Reply

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