Sample all PowerShell Console Colors

I often need to pick console colors to use making host text a little easier to look at (coupled with smart indentation).  The –Foregroundcolor parameter of the Write-Host cmdlet is what I commonly use to set text colors.  I like to use lots of colors, but sometimes I forget what all the colors are and what they look like (the look is more important).  The Intellisense in the v3+ ISE is great that it suggests the color names (tab completion will as well), but sometimes I need to be reminded of what each looks like.  Here is a simple little one-liner that will show the color names in their appropriate color.  I use this line every so often to remind me.

PS > [enum]::GetValues([System.ConsoleColor]) | Foreach-Object {Write-Host $_ -ForegroundColor $_}      

Black

DarkBlue      

DarkGreen      

DarkCyan      

DarkRed      

DarkMagenta      

DarkYellow      

Gray      

DarkGray      

Blue      

Green      

Cyan    

Red      

Magenta      

Yellow

White <-- White is here, but you can’t see it)

Hopefully this trick helps someone out.

-Gary Siepser