PowerTip: Use PowerShell to list all possible colors in the console

Summary: Use PowerShell and enumeration to access all possible colors that you can use in the console.

Hey, Scripting Guy! Question Is there a way to see all of the available colors that I can use when using Write-Host?

Hey, Scripting Guy! Answer We sure can! Why, with just one line in PowerShell, you’re all done! Here is an example:


The Doctor

Comments (1)

  1. James Brown says:

    But what *are* the colors?

    $colors = [System.Enum]::getvalues([System.ConsoleColor])
    foreach ($color in $colors) {Write-Host -ForegroundColor $color “This is the color ‘$color'”}

Skip to main content