backgroundColor
and foregroundColor
of the $host.ui.rawUI
allow to define the foreground and background color when text is written to a PowerShell host's console. psReadLineOption
. System.ConsoleColor
. write-*
cmdlets (write-error
etc.) can be set in the $host.privateData
object.