Get Powershell Foreground colors

Below Powershell command lists all foreground colors available:

[Enum]::GetValues([System.ConsoleColor])

Example:
PS C:\> [Enum]::GetValues([System.ConsoleColor])Black
DarkBlue
DarkGreen
DarkCyan
DarkRed
DarkMagenta
DarkYellow
Gray
DarkGray
Blue
Green
Cyan
Red
Magenta
Yello

Ref : https://stackoverflow.com/questions/20541456/list-of-all-colors-available-for-powershell


Get the colours displayed in screen with below script:
$colors = [enum]::GetValues([System.ConsoleColor])
Foreach ($bgcolor in $colors){
    Foreach ($fgcolor in $colors) { Write-Host "$fgcolor|"  -ForegroundColor $fgcolor -BackgroundColor $bgcolor -NoNewLine }
    Write-Host " on $bgcolor"
}

Comments

Popular posts from this blog

vRA/vRO workflows

How to generate HPS Report for Windows