Skip to main content

Delete custom color themes from SharePoint

Author: Laura Kokkarinen

Have you been creating a lot of beautiful themes lately and testing them in your dev tenant, but don’t want to keep them anymore? If yes, then this PowerShell script is for you.

$sparksjoy = "Cat Lovers United", "Multicolored theme"
$themes = m365 spo theme list -o json | ConvertFrom-Json
$themes = $themes | where {-not ($sparksjoy -contains $_.name)}
$themes | Format-Table name
if ($themes.Count -eq 0) { break }
Read-Host -Prompt "Press Enter to start deleting (CTRL + C to exit)"
$progress = 0
$total = $themes.Count
foreach ($theme in $themes)
{
$progress++
write-host $progress / $total":" $theme.name
m365 spo theme remove --name "$($theme.name)" --force
}
CTRL + M