目前从Console Colors中选择的16种颜色对我来说不是正确的选择.我想在背景中使用这些更暗的变体.
我绝对可以使用UI设置这些并在那里更改RGB值.
例如,我可以选择Darkblue并在RGB部分选择65 for Blue(128是默认值).有人可以告诉我如何以编程方式执行此操作.
就像是:
(Get-Host).UI.RawUI.BackgroundColor=DarkBlue
但有额外的选择.
解决方法
Lee Holmes的这篇老帖解释了如何将颜色更改为您想要的任何值.您必须更改注册表 –
http://www.leeholmes.com/blog/2008/06/01/powershells-noble-blue/
Push-Location Set-Location HKCU:\Console New-Item ".\%SystemRoot%_system32_WindowsPowerShell_v1.0_powershell.exe" Set-Location ".\%SystemRoot%_system32_WindowsPowerShell_v1.0_powershell.exe" New-ItemProperty . ColorTable00 -type DWORD -value 0×00562401 New-ItemProperty . ColorTable07 -type DWORD -value 0x00f0edee New-ItemProperty . FaceName -type STRING -value "Lucida Console" New-ItemProperty . FontFamily -type DWORD -value 0×00000036 New-ItemProperty . FontSize -type DWORD -value 0x000c0000 New-ItemProperty . FontWeight -type DWORD -value 0×00000190 New-ItemProperty . HistoryNoDup -type DWORD -value 0×00000000 New-ItemProperty . QuickEdit -type DWORD -value 0×00000001 New-ItemProperty . ScreenBufferSize -type DWORD -value 0x0bb80078 New-ItemProperty . WindowSize -type DWORD -value 0×00320078 Pop-Location