forked from LeDragoX/Win-Debloat-Tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Title-Templates.psm1
207 lines (178 loc) · 9.16 KB
/
Title-Templates.psm1
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
function Get-AllStyle() {
[CmdletBinding()]
param (
[Parameter(Position = 0)]
[System.Object] $Object = "Yay!"
)
for ($i = 0; $i -le 110; $i++) {
<# Action that will repeat until the condition is met #>
Write-Host "$([char]0x1b)[$i`m [$i] $Object"
}
}
function Write-Caption() {
[CmdletBinding()]
param (
[Parameter(Position = 0)]
[System.Object] $Object = ''
)
Write-Style "••>" -Style Bold -Color DarkGray -BackColor Cyan -NoNewline
Write-Style " $Object" -Style Italic -Color White -BackColor DarkGray
}
function Write-ScriptLogo() {
[CmdletBinding()] param ()
# Font: ANSI FIGlet Fonts > ANSI Shadow
$ASCIIText = @"
██╗ ██╗██╗███╗ ██╗ ██████╗ ███████╗██████╗ ██╗ ██████╗ █████╗ ████████╗
██║ ██║██║████╗ ██║ ██╔══██╗██╔════╝██╔══██╗██║ ██╔═══██╗██╔══██╗╚══██╔══╝
██║ █╗ ██║██║██╔██╗ ██║ ██║ ██║█████╗ ██████╔╝██║ ██║ ██║███████║ ██║
██║███╗██║██║██║╚██╗██║ ██║ ██║██╔══╝ ██╔══██╗██║ ██║ ██║██╔══██║ ██║
╚███╔███╔╝██║██║ ╚████║ ██████╔╝███████╗██████╔╝███████╗╚██████╔╝██║ ██║ ██║
╚══╝╚══╝ ╚═╝╚═╝ ╚═══╝ ╚═════╝ ╚══════╝╚═════╝ ╚══════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝
████████╗ ██████╗ ██████╗ ██╗ ███████╗
╚══██╔══╝██╔═══██╗██╔═══██╗██║ ██╔════╝
██║ ██║ ██║██║ ██║██║ ███████╗
██║ ██║ ██║██║ ██║██║ ╚════██║
██║ ╚██████╔╝╚██████╔╝███████╗███████║
╚═╝ ╚═════╝ ╚═════╝ ╚══════╝╚══════╝
"@
Write-Style $ASCIIText -Style Blink -Color Green
Write-Style "`n<•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••>" -Color White
Write-Style " It's Time to Debloat Windows!" -Style Blink -Color Cyan
}
function Write-Section() {
[CmdletBinding()]
param (
[Parameter(Position = 0)]
[System.Object] $Object = ''
)
$Art = @('<••••••••••', '••••••••••>')
Write-Style "`n$($Art[0])" -Style Bold -Color DarkGray -BackColor Cyan -NoNewline
Write-Style "{ $Object }" -Style Italic -Color White -BackColor DarkGray -NoNewline
Write-Style "$($Art[1])" -Style Bold -Color DarkGray -BackColor Cyan
Write-Host
}
function Write-Status() {
[CmdletBinding()]
param (
[Parameter(Position = 0, Mandatory)]
[String[]] $Types,
[Parameter(Position = 1, Mandatory)]
[String] $Status,
[Switch] $Warning
)
$TypesDone = ""
ForEach ($Type in $Types) {
$TypesDone += "$([char]0x1b)[96m[$([char]0x1b)[97m$Type$([char]0x1b)[96m] "
}
Write-Style "$TypesDone".Trim() -Style Bold -BackColor DarkGray -NoNewline
If ($Warning) {
Write-Style " $Status" -Color Yellow -BackColor DarkBlue
} Else {
Write-Style " $Status" -Color Green -BackColor Black
}
}
function Write-Style() {
[CmdletBinding()]
param (
[Parameter(Position = 0)]
[System.Object] $Object = '',
[Parameter(Position = 1)]
[ValidateSet('Blink', 'Bold', 'Italic', 'Regular', 'Strikethrough', 'Underline')]
[String] $Style = 'Regular',
[Alias('Color')]
[Parameter(Position = 2)]
[ValidateSet('Black', 'Blue', 'DarkBlue', 'DarkCyan', 'DarkGray', 'DarkGreen', 'DarkMagenta', 'DarkRed', 'DarkYellow', 'Cyan', 'Gray', 'Green', 'Red', 'Magenta', 'White', 'Yellow')]
[String] $ForeColor = 'White',
[Parameter(Position = 3)]
[ValidateSet('Black', 'Blue', 'DarkBlue', 'DarkCyan', 'DarkGray', 'DarkGreen', 'DarkMagenta', 'DarkRed', 'DarkYellow', 'Cyan', 'Gray', 'Green', 'Red', 'Magenta', 'White', 'Yellow')]
[String] $BackColor = 'Black',
[Parameter(Position = 4)]
[Switch] $NoNewline
)
$BackColors = @{
"Black" = "$([char]0x1b)[40m"
"DarkBlue" = "$([char]0x1b)[44m"
"DarkGreen" = "$([char]0x1b)[42m"
"DarkCyan" = "$([char]0x1b)[46m"
"DarkGray" = "$([char]0x1b)[100m"
"DarkRed" = "$([char]0x1b)[41m"
"DarkMagenta" = "$([char]0x1b)[45m" # Doesn't work on PowerShell, but works on the Terminal
"DarkYellow" = "$([char]0x1b)[43m"
"Gray" = "$([char]0x1b)[47m"
"Blue" = "$([char]0x1b)[104m"
"Green" = "$([char]0x1b)[102m"
"Cyan" = "$([char]0x1b)[106m"
"Red" = "$([char]0x1b)[101m"
"Magenta" = "$([char]0x1b)[105m"
"Yellow" = "$([char]0x1b)[103m"
"White" = "$([char]0x1b)[107m"
}
$ForeColors = @{
"Black" = "$([char]0x1b)[30m"
"DarkBlue" = "$([char]0x1b)[34m"
"DarkGreen" = "$([char]0x1b)[32m"
"DarkCyan" = "$([char]0x1b)[36m"
"DarkGray" = "$([char]0x1b)[90m"
"DarkRed" = "$([char]0x1b)[31m"
"DarkMagenta" = "$([char]0x1b)[35m" # Doesn't work on PowerShell, but works on the Terminal
"DarkYellow" = "$([char]0x1b)[33m"
"Gray" = "$([char]0x1b)[37m"
"Blue" = "$([char]0x1b)[94m"
"Green" = "$([char]0x1b)[92m"
"Cyan" = "$([char]0x1b)[96m"
"Red" = "$([char]0x1b)[91m"
"Magenta" = "$([char]0x1b)[95m"
"Yellow" = "$([char]0x1b)[93m"
"White" = "$([char]0x1b)[97m"
}
$Styles = @{
"Blink" = "$([char]0x1b)[5m"
"Bold" = "$([char]0x1b)[1m"
"Italic" = "$([char]0x1b)[3m"
"Regular" = "$([char]0x1b)[0m"
"Strikethrough" = "$([char]0x1b)[9m"
"Underline" = "$([char]0x1b)[4m"
}
If ($NoNewline) {
return Write-Host "$($Styles.$Style)$($BackColors.$BackColor)$($ForeColors.$ForeColor)$Object" -NoNewline
}
Write-Host "$($Styles.$Style)$($BackColors.$BackColor)$($ForeColors.$ForeColor)$Object"
}
function Write-Title() {
[CmdletBinding()]
param (
[Parameter(Position = 0)]
[System.Object] $Object = ''
)
$Art = "<•••••••••••••••••••••••••••••••••••••••••••••••••••••••>"
Write-Style "`n$([char]0x1b)[94m$Art" -Style Bold -BackColor Black -NoNewline
Write-Style "`n$([char]0x1b)[97m $Object" -Style Italic -BackColor Black -NoNewline
Write-Style "`n$([char]0x1b)[94m$Art" -Style Bold -BackColor Black
}
function Write-TitleCounter() {
[CmdletBinding()]
[OutputType([System.Int32])]
param (
[Parameter(Position = 0)]
[System.Object] $Object = '',
[Parameter(Position = 1)]
[Int] $Counter = 0,
[Parameter(Position = 2)]
[Int] $MaxLength
)
$Counter += 1
Write-Title "($Counter/$MaxLength) - $Object"
return $Counter
}
<#
Example:
Write-Caption -Object "Text" # Used to print Tweak Category
Write-ScriptLogo # Used at the start of the Script
Write-Section -Object "Text" # Used to print Tweak Section
Write-Status -Types "?", ... -Status "Doing something"
Write-Status -Types "?", ... -Status "Doing something" -Warning
Write-Title -Object "Text" # Used to print Tweak introduction
$Private:Counter = Write-TitleCounter -Object "Text" -Counter $Counter -MaxLenght 100 # Used to print when working with collections # No need to iterate $Counter before, as long it's private
$Private:Counter = Write-TitleCounter -Object "Text" -Counter $Counter -MaxLenght 100 # Used to print when working with collections # No need to iterate $Counter before, as long it's private
#>
# [enum]::GetValues([System.ConsoleColor]) | Foreach-Object {Write-Host $_ -ForegroundColor $_ }