I have my powershell console window have a black background and slightly transparent. The default colors here work for most things, except errors. Errors were hard to read, especially when projecting to a secondary monitor. I found on the web that you can change the foreground color for powershell errors by setting $host.privatedata.ErrorForegroundColor. But the problem with these solutions that I found was that they just said “from a PS prompt, set the color”. I wanted something a little more permanent.
What I came up with was to set the values that I want in my PowerShell profile file that is located at [Environment]::GetFolderPath("MyDocuments")/WindowsPowerShell/Microsoft.PowerShell_profile.ps1.
Here is what I put in mine:
$host.privatedata.ErrorForegroundColor = 'Magenta'; $host.privatedata.ErrorBackgroundColor = 'Black'; $host.privatedata.WarningForegroundColor = 'Yellow'; $host.privatedata.WarningBackgroundColor = 'Black'; $host.privatedata.DebugForegroundColor = 'DarkGray'; $host.privatedata.DebugBackgroundColor = 'Black'; $host.privatedata.VerboseForegroundColor = 'White'; $host.privatedata.VerboseBackgroundColor = 'Black'; $host.privatedata.ProgressForegroundColor = 'DarkBlue'; $host.privatedata.ProgressBackgroundColor = 'DarkCyan';
Now my errors are readable.
To see what values you can set them to just execute: [system.consolecolor]::GetNames("consolecolor").