PowerShell: Change color in powershell window

function SetColor ($bc,$fc)
{
	$a = (Get-Host).UI.RawUI
	$a.BackgroundColor = $bc
	$a.ForegroundColor = $fc ; cls
}

SetColor "Magenta" "black"

You can use the following color codes:
Black
White
Gray
DarkGray
Red
DarkRed
Blue
DarkBlue
Green
DarkGreen
Yellow
DarkYellow
Cyan
DarkCyan
Magenta
DarkMagenta

Leave a Reply

Your email address will not be published.