La gestion des Thèmes de SharePoint Online est désormais différente avec l’arrivée des pages modernes et son implementation dans les Office 365 Groups et tous les modules connexes (Teams, Stream, Planner, …).
De ce fait, la manière de faire ne passe maintenant que via les jeux de couleur au niveau du Tenant Office 365 et voici comment faire en PowerShell
[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, $secureStringPwdConnect-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-SPOHideDefaultThemesWrite-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
A ce moment, le nouveau jeu de couleur est visible en cliquant sur la roue (Settings) et sélectionnant “Change the look”:
Pour trouver plus d’informations, vous pouvez aller sur les documentations officielles de Microsoft ou naviguer sur les pages suivantes:
- https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/site-theming/sharepoint-site-theming-overview
- https://docs.microsoft.com/en-us/powershell/module/sharepoint-online/?view=sharepoint-ps
- https://github.com/SharePoint/sp-dev-docs/blob/master/docs/declarative-customization/site-theming/sharepoint-site-theming-json-schema.md
- http://itgroove.net/align/change-color-spo-modern-experience/
- https://laurakokkarinen.com/how-to-create-a-multicolored-theme-for-a-modern-sharepoint-online-site/
- http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2017/10/17/how-to-use-powershell-to-customize-the-theme-of-a-sharepoint-modern-site.aspx
Fabrice Romelard
Commentaires
Enregistrer un commentaire