-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathNew-WTColorScheme.ps1
144 lines (125 loc) · 4.62 KB
/
New-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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
function New-WTColorScheme
{
<#
.Synopsis
Creates Windows Terminal Color Schemes
.Description
Creates a new Windows Terminal Color Scheme
.Link
Add-WTColorScheme
.Example
New-WTColorScheme -Name MyColorScheme
#>
[OutputType([PSObject])]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute(
"PSUseShouldProcessForStateChangingFunctions", "", Justification="Not changing state"
)]
param(
# The name of the color scheme
[Parameter(Mandatory,ValueFromPipelineByPropertyName)]
[string]
$Name,
# The scheme's definition of the color Black.
[Parameter(ValueFromPipelineByPropertyName)]
[ValidatePattern('^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$')]
[string]
$Black = '#010101',
# The scheme's definition of the color Red.
[Parameter(ValueFromPipelineByPropertyName)]
[ValidatePattern('^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$')]
[string]
$Red = '#dd0000',
# The scheme's definition of the color Green.
[Parameter(ValueFromPipelineByPropertyName)]
[ValidatePattern('^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$')]
[string]
$Green = '#00dd00',
# The scheme's definition of the color Yellow.
[Parameter(ValueFromPipelineByPropertyName)]
[ValidatePattern('^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$')]
[string]
$Yellow = '#dddd00',
# The scheme's definition of the color Blue.
[Parameter(ValueFromPipelineByPropertyName)]
[ValidatePattern('^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$')]
[string]
$Blue = '#0000dd',
# The scheme's definition of the color Cyan.
[Parameter(ValueFromPipelineByPropertyName)]
[ValidatePattern('^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$')]
[string]
$Cyan = '#00dddd',
# The scheme's definition of the color Purple.
[Parameter(ValueFromPipelineByPropertyName)]
[ValidatePattern('^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$')]
[Alias('Magenta')]
[string]
$Purple = '#dd00dd',
# The scheme's definition of the color White.
[Parameter(ValueFromPipelineByPropertyName)]
[ValidatePattern('^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$')]
[string]
$White = '#efefef',
# The scheme's definition of the color BrightRed.
[Parameter(ValueFromPipelineByPropertyName)]
[ValidatePattern('^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$')]
[string]
$BrightRed = '#ff0000',
# The scheme's definition of the color BrightGreen.
[Parameter(ValueFromPipelineByPropertyName)]
[ValidatePattern('^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$')]
[string]
$BrightGreen = '#00ff00',
# The scheme's definition of the color BrightYellow.
[Parameter(ValueFromPipelineByPropertyName)]
[ValidatePattern('^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$')]
[string]
$BrightYellow = '#ffff00',
# The scheme's definition of the color BrightBlue.
[Parameter(ValueFromPipelineByPropertyName)]
[ValidatePattern('^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$')]
[string]
$BrightBlue = '#0000ff',
# The scheme's definition of the color BrightPurple.
[Parameter(ValueFromPipelineByPropertyName)]
[ValidatePattern('^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$')]
[string]
$BrightPurple = '#ff00ff',
# The scheme's definition of the color BrightCyan.
[Parameter(ValueFromPipelineByPropertyName)]
[ValidatePattern('^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$')]
[string]
$BrightCyan = '#00ffff',
# The scheme's definition of the color BrightWhite.
[Parameter(ValueFromPipelineByPropertyName)]
[ValidatePattern('^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$')]
[string]
$BrightWhite = '#ffffff',
# The scheme's definition of the color BrightBlack.
[Parameter(ValueFromPipelineByPropertyName)]
[ValidatePattern('^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$')]
[string]
$BrightBlack = '#0d0d0d',
# The scheme's foreground color.
[Parameter(ValueFromPipelineByPropertyName)]
[ValidatePattern('^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$')]
[string]
$Foreground = '#fefefe',
# The scheme's background color.
[Parameter(ValueFromPipelineByPropertyName)]
[ValidatePattern('^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$')]
[string]
$Background = '#012456'
)
process {
#region Create Color Scheme Object
$myCmdMetaData = [Management.Automation.CommandMetaData]$MyInvocation.MyCommand
$newColorScheme = [Ordered]@{}
foreach ($p in $myCmdMetaData.Parameters.Keys) {
$k = $p.Substring(0,1).ToLower() + $p.Substring(1)
$newColorScheme[$k] = $ExecutionContext.SessionState.PSVariable.Get($p).Value
}
[PSCustomObject]$newColorScheme
#endregion Create Color Scheme Object
}
}