PowerShell modules that provides a function to write text to console with specified words highlighted in colors.
Install from Powershell Gallery Repository
Install-Module -Name ColorizedHost
Write-ColorizedHost -Word "Success", "Warning", "Error" -Color Green, Yellow, Red -Text "This is some text. The previous action was a success. Not an error or warning."
This will output the text with the word "Sucess" colored in green and the word "Error" colored red.
This is some text. The previous action was a success. Not an error or warning." | Write-ColorizedHost -Word "Success", "Warning", "Error" -Color Green, Yellow, Red
The same output as example 1, but this uses pipeline input.