Skip to content

Instantly share code, notes, and snippets.

@adamdriscoll
Created December 15, 2020 21:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamdriscoll/cfb2a36bedd16ed5bbd65f01732ae844 to your computer and use it in GitHub Desktop.
Save adamdriscoll/cfb2a36bedd16ed5bbd65f01732ae844 to your computer and use it in GitHub Desktop.
Out-ColorString
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