PowerShell : List of Available Colors

Colors are great and powerful way to get your attention. Good color helps us better understand at a glance the information being displayed so we can act on that information more quickly and effectively. When using powershell, we can make use of the color when we display the information.

To list up all possible colors available, we can make use of [System.Enum]::GetValues(‘ConsoleColor’).

[System.Enum]::GetValues('ConsoleColor') | ForEach-Object `
    { Write-Host "$_ " -ForegroundColor $_ -NoNewline; Write-Host $_ -BackgroundColor $_ }

Here are the colors that you can use:
Black
DarkBlue
DarkGreen
DarkCyan
DarkRed
DarkMagenta
DarkYellow
Gray
DarkGray
Blue
Green
Cyan
Red
Magenta
Yellow
White

thatnavguy

Experienced NZ-based NAV Developer and Consultant with 15+ years of experience leading multiple IT projects, performing business analyst, developing, implementing, and upgrading Dynamics NAV and Business Central. Passionate to deliver solution that focuses on user-friendly interface while keeping high standard of compliance with the needs.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *