Delete the theme file from the theme gallery in SharePoint using powershell


$site=Get-SPSite "http://servername:1111/sites/Media1"
$web=$site.RootWeb
if ($web.GetFile("_catalogs/theme/CustomTheme.thmx").Exists -eq $true)
{
   $file = web.GetFile("_catalogs/theme/CustomTheme.thmx")
   $file.Delete();
}
else
{
   write-host -f yellow "File does not exists in the Theme Gallery"
}