如何以编程方式将Powershell背景色设置为RGB值 [英] How to set Powershell background color programmatically to RGB Value
问题描述
从控制台颜色"中当前选择的16种颜色对我来说不是正确的选择.我想在背景中使用更深的变体.
The current selection of 16 colors from Console Colors is not the right choice for me. I would like to use much darker variants of these for the background.
我绝对可以使用UI进行设置,并在那里更改RGB值.
I could definitely set these using the UI and changing the RGB value there.
例如,我可以选择深蓝色",然后在"RGB"部分为蓝色"选择65(默认值为128).有人可以告诉我如何以编程方式做到这一点.
For example, I could choose Darkblue and select 65 for Blue in the RGB section(128 is the default). Could some one tell me how to do this programmatically.
类似的东西:
(Get-Host).UI.RawUI.BackgroundColor=DarkBlue
但还有其他选择.
推荐答案
Lee Holmes的旧文章解释了如何将颜色更改为所需的任何值.您必须更改注册表- http://www.leeholmes.com/blog/2008/06/01/powershells-noble-blue/
This old post by Lee Holmes explains how you can go about changing the color to any value you want. You have to change the registry - 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
这篇关于如何以编程方式将Powershell背景色设置为RGB值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!