mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-05-16 13:34:51 +02:00
1.6 KiB
1.6 KiB
The list-console-colors.ps1 Script
This PowerShell script lists all available console colors.
Parameters
/Repos/PowerShell/scripts/list-console-colors.ps1 [<CommonParameters>]
[<CommonParameters>]
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
WarningVariable, OutBuffer, PipelineVariable, and OutVariable.
Example
PS> ./list-console-colors.ps1
Color As Foreground As Background
----- ------------- -------------
...
Notes
Author: Markus Fleschutz | License: CC0
Related Links
https://github.com/fleschutz/PowerShell
Script Content
<#
.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
}
(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:55)