I know I can change PowerShell console colors by setting in my profile something like:
$Host.UI.RawUI.BackgroundColor = \"White\"
Clear-Host
<
You can, but not via the $Host
object. The color table is stored in the registry.
You would use the same names, but the colors would be different. That's why the default PowerShell console is blue/gray.
I doubt that's possible. The $Host.UI.RawUI.BackgroundColour is a System.ConsoleColor enumerator, thus there's only a finite set of colours that you could select. http://msdn.microsoft.com/en-GB/library/system.consolecolor.aspx
For anyone that may be looking to custom color the Powershell ISE here is the format.
#Get the list of colors and hex equivalents
[windows.media.colors] | Get-Member -Static -MemberType property |
ForEach-Object {
$psISE.Options.ConsolePaneTextBackgroundColor = `
([windows.media.colors]::$($_.name)).tostring()
“$($_.name) `t $([windows.media.colors]::$($_.name))”
}
#Example of how to change the console color in the powershell ISE
$psISE.Options.ConsolePaneBackgroundColor = '#FF4169E1' #RoyalBlue
$psISE.Options.ConsolePaneTextBackgroundColor = '#00FFFFFF' #Transparent
Proper credit belongs to "The scripting Guy", sorry I don't have the link but the code is directly from his website.
The correct way to do this is with the Registry
cd hkcu:/console
$0 = '%systemroot%_system32_windowspowershell_v1.0_powershell.exe'
ni $0 -f
sp $0 ColorTable00 0x00562401
sp $0 ColorTable07 0x00f0edee
With the color being
0x00BBGGRR
As far as I know, you can't. The console API doesn't support custom color. If you do this:
$x = (Get-Host).UI.RawUI
$x | gm
you'll see that BackgroundColor is of type System.ConsoleColor.