Add list-console-colors.ps1

This commit is contained in:
Markus Fleschutz 2021-08-27 16:06:13 +02:00
parent f0c3a7b25c
commit 6b55c445d3
3 changed files with 33 additions and 0 deletions

View File

@ -91,6 +91,7 @@ list-branches.ps1, lists all branches in the current/given Git repository
list-cheat-sheet.ps1, lists the PowerShell cheat sheet
list-city-weather.ps1, lists the current weather of cities worldwide (east to west)
list-commits.ps1, lists all commits in the current/given Git repository
list-console-colors.ps1, lists all console colors
list-cli-tools.ps1, lists available command-line interface (CLI) tools
list-clipboard.ps1, lists the contents of the clipboard
list-credits.ps1, shows the credits

Can't render this file because it has a wrong number of fields in line 85.

View File

@ -193,6 +193,7 @@ Mega Collection of PowerShell Scripts
* [list-automatic-variables.ps1](Scripts/list-automatic-variables.ps1) - lists the automatic variables of PowerShell
* [list-cheat-sheet.ps1](Scripts/list-cheat-sheet.ps1) - lists the PowerShell cheat sheet
* [list-cmdlets.ps1](Scripts/list-cmdlets.ps1) - lists the PowerShell cmdlets
* [list-console-colors.ps1](Scripts/list-console-colors.ps1) - lists all console colors
* [list-modules.ps1](Scripts/list-modules.ps1) - lists the PowerShell modules
* [list-profiles.ps1](Scripts/list-profiles.ps1) - lists your PowerShell profiles
* [list-scripts.ps1](Scripts/list-scripts.ps1) - lists all PowerShell scripts in this repository

31
Scripts/list-console-colors.ps1 Executable file
View File

@ -0,0 +1,31 @@
<#
.SYNOPSIS
list-console-colors.ps1
.DESCRIPTION
Lists all console colors
.EXAMPLE
PS> .\list-console-colors.ps1
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz
Creation Date: 2021-08-27
License: CC0
#>
try {
$Colors = [Enum]::GetValues([ConsoleColor])
""
"Name `tForeground `tBackground"
"---- `t---------- `t----------"
foreach($Color in $Colors) {
write-host -noNewline "$Color `t"
write-host -noNewline -foregroundcolor $Color "$Color `t"
write-host -noNewline -backgroundcolor $Color "$Color"
write-host ""
}
exit 0
} catch {
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}