notes/Color Text Examples-LKq6FjPT.sh
<#
Text Color Examples
Example useage:
PowerShell -ExecutionPolicy Bypass .\colors.ps1
#>
$colors = "Black","Blue","Cyan","DarkBlue","DarkCyan","DarkGray","DarkGreen","DarkMagenta","DarkRed","DarkYellow","Gray","Green","Magenta","Red","White","Yellow"
#forground colors
foreach ($color in $colors){
write-host "This is $color text." -foregroundcolor $color
}
foreach ($color in $colors){
write-host "This has a $color background." -backgroundcolor $color
}
$text = "Many Colors Used Here..."
$text = $text.ToCharArray()
foreach ($letter in $text){
$colors = $colors| Sort-Object {Get-Random}
write-host "$letter" -foregroundcolor $colors[0] -NoNewline
}
syntax highlighted by Code2HTML, v. 0.9.1