Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <#
- 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
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement