mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-04-21 17:38:19 +02:00
35 lines
841 B
PowerShell
Executable File
35 lines
841 B
PowerShell
Executable File
<#
|
|
.SYNOPSIS
|
|
Lists all console colors
|
|
.DESCRIPTION
|
|
This PowerShell script lists all available console colors.
|
|
.EXAMPLE
|
|
PS> ./list-console-colors.ps1
|
|
|
|
Color As Foreground As Background
|
|
----- ------------- -------------
|
|
...
|
|
.LINK
|
|
https://github.com/fleschutz/PowerShell
|
|
.NOTES
|
|
Author: Markus Fleschutz | License: CC0
|
|
#>
|
|
|
|
try {
|
|
$colors = [Enum]::GetValues([ConsoleColor])
|
|
""
|
|
"COLOR FOREGROUND BACKGROUND"
|
|
"----- ---------- ----------"
|
|
foreach($color in $colors) {
|
|
$color = "$color "
|
|
$color = $color.substring(0, 15)
|
|
Write-Host "$color" -noNewline
|
|
Write-Host "$color" -foregroundColor $color -noNewline
|
|
Write-Host "$color" -backgroundColor $color
|
|
}
|
|
exit 0 # success
|
|
} catch {
|
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
|
exit 1
|
|
}
|