Forum Discussion

Fromelard's avatar
Fromelard
Steel Contributor
Jul 04, 2018

SharePoint Online - Configure the Theme for the modern look pages

The Theme and color management is now different for SharePoint Online, due to the implementation of the Office 365 Groups and​ all the connected services (Teams, Planner, Stream, ...).
The solution to change the color set is now directly at the tenant level using the following PowerShell Script:
    [string]$themePaletteCustomName = "Your Customized Theme"
    $themepaletteCustom = @{
		"themePrimary" = "#102542"; #Navy
		"themeLighterAlt" = "#d6e3f5";
		"themeLighter" = "#fef1ef"; #Coral, themeLighter
		"themeLight" = "#fde2df"; #Coral, themeLight
		"themeTertiary" = "#6495da";
		"themeSecondary" = "#3e7bd1";
		"themeDarkAlt" = "#F87060"; #Coral
		"themeDark" = "#F87060"; #Coral
		"themeDarker" = "#193a68";
		"neutralLighterAlt" = "#f8f8f8";
		"neutralLighter" = "#f4f4f4";
		"neutralLight" = "#eaeaea";
		"neutralQuaternaryAlt" = "#dadada";
		"neutralQuaternary" = "#d0d0d0";
		"neutralTertiaryAlt" = "#c8c8c8";
		"neutralTertiary" = "#e2e2e2";
		"neutralSecondary" = "#53C7BD"; #Turquoise
		"neutralPrimaryAlt" = "#656565";
		"neutralPrimary" = "#6f6f6f";
		"neutralDark" = "#4f4f4f";
		"black" = "#3e3e3e";
		"white" = "#ffffff";
		"primaryBackground" = "#ffffff";
		"primaryText" = "#6f6f6f";
		"bodyBackground" = "#ffffff";
		"bodyText" = "#6f6f6f";
		"disabledBackground" = "#f4f4f4";
		"disabledText" = "#c8c8c8";
		"accent" = "#F87060"; #Coral
    }

	[string]$username = "Admin@tenant.onmicrosoft.com"
	[string]$PwdTXTPath = "D:\SECUREDPWD\ExportedPWD-$($username).txt"
    $secureStringPwd = ConvertTo-SecureString -string (Get-Content $PwdTXTPath)
    $adminCreds = New-Object System.Management.Automation.PSCredential $username, $secureStringPwd

    Connect-SPOService -Url https://Tenant-admin.sharepoint.com -credential $adminCreds -ErrorAction SilentlyContinue -ErrorVariable Err

    # TO CHANGE THE USAGE OF THE DEFAULT COLORSET CHOICE
        Write-Host "   =>Status for the Default Theme Availability in modern site"
        Get-SPOHideDefaultThemes

    Write-Host "   => Hide the default Theme in the modern site"
    Set-SPOHideDefaultThemes $false #Or $True if you want to hide all
    Write-Host "   =>Status for the Default Theme Availability in modern site"
    Get-SPOHideDefaultThemes

# TO GET ALL THE PERSONAL COLORSET ADD AT THE TENANT LEVEL

    $AllThemes = Get-SPOTheme
    Write-Host "     >> Customited Theme Installed:", $AllThemes.count
    Write-Host "--------------------------------------------------------------------------------------------"
    Add-SPOTheme -Name $themePaletteCustomName -Palette $themepaletteCustom -IsInverted $false -Overwrite

#TO REMOVE THE CUSTOMIZED THEME YOU DON'T WANT ANYMORE

    #Remove-SPOTheme -Name $themePaletteCustomName 

    $AllThemes = Get-SPOTheme
The result is visible into the modern pages clicking on the wheel button and select "Change the look":Change the look menu

 

 

 

Resources