Created
December 15, 2020 21:28
-
-
Save adamdriscoll/cfb2a36bedd16ed5bbd65f01732ae844 to your computer and use it in GitHub Desktop.
Out-ColorString
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Out-ColorString { | |
param([Parameter(ValueFromPipeline = $true)]$InputObject) | |
Begin { | |
$Items = @() | |
} | |
Process { | |
$Items += $InputObject | |
} | |
End { | |
($Items | Out-String) -split "`r`n" | ForEach-Object { | |
foreach($char in $_.GetEnumerator()) | |
{ | |
Write-Host $char -ForegroundColor ([Enum]::GetValues([System.ConsoleColor]) | Get-Random) -BackgroundColor ([Enum]::GetValues([System.ConsoleColor]) | Get-Random) -NoNewline | |
} | |
Write-Host "" | |
} | |
} | |
} | |
Get-Process | Out-ColorString |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment