PowerShell/scripts/list-console-colors.ps1
2025-02-06 16:39:44 +01:00

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
}