Usually to output information in PowerShell we use Write-Host. By using parameters ForegroundColor and BackgroundColor parameters you can define nice looking output text.

Write-Host "Whole text is in green" -ForegroundColor Green Write-Host "Whole text is in red" -ForegroundColor Red Write-Host "Whole text is in white" -ForegroundColor White Write-Host "Whole text is in red with background Yellow" -ForegroundColor Red -BackgroundColor Yellow Write-Host "Whole text is in yellow with background Dark Green" -ForegroundColor Yellow -BackgroundColor DarkGreen

While it's usually good enough for most scripts sometimes formatting one line of script with multiple colors is required. Wouldn't it fun to have Green Red Yellow outputed by PowerShell script?

You can actually do that with 3 “simple lines.

Write-Host "Green " -ForegroundColor Green -NoNewline; Write-Host "Red " -ForegroundColor Red -NoNewline; Write-Host "Yellow " -ForegroundColor Yellow -NoNewline;

Or even have it as one-liner:

Write-Host "Green " -ForegroundColor Green -NoNewline; Write-Host "Red " -ForegroundColor Red -NoNewline; Write-Host "Yellow " -ForegroundColor Yellow -NoNewline;

While this works it makes code very hard to read!