-
Notifications
You must be signed in to change notification settings - Fork 1
/
Remove-WTColorScheme.ps1
45 lines (42 loc) · 1.24 KB
/
Remove-WTColorScheme.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
function Remove-WTColorScheme
{
<#
.Synopsis
Removes color schemes from Windows Terminal.
.Description
Removes registered color schemes from Windows Terminal.
.Example
Remove-WTColorScheme -Name "The Hulk"
.Link
Add-WTColorScheme
.Link
Get-WTColorScheme
.Link
Set-WTColorScheme
#>
[CmdletBinding(SupportsShouldProcess,ConfirmImpact='Low')]
param(
# The name of the color scheme.
[Parameter(Mandatory,ValueFromPipelineByPropertyName)]
[Alias('Name')]
[string[]]
$ColorScheme
)
process {
#region Get Color Scheme
$null = $PSBoundParameters.Remove('Confirm')
$null = $PSBoundParameters.Remove('WhatIf')
$allSchemes = Get-WTProfile -Global | Select-Object -ExpandProperty Schemes
$updatedSchemes = @($allSchemes |
Where-Object {
foreach ($cs in $ColorScheme) {
if ($_.Name -like $cs) { return $false }
}
return $true
})
if ($PSCmdlet.ShouldProcess("Remove $ColorScheme")) {
Set-WTProfile -ColorScheme $updatedSchemes -Confirm:$false -Global
}
#endregion Get Color Scheme
}
}