powershell - 如何以编程方式将Powershell背景色设置为RGB值

标签 powershell console

从“控制台颜色”中当前选择的16种颜色对我来说不是正确的选择。我想在背景中使用这些颜色的深变体。

我绝对可以使用UI并在其中更改RGB值进行设置。

例如,我可以选择“深蓝色”,然后在“RGB”部分为“蓝色”选择65(默认值为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

关于powershell - 如何以编程方式将Powershell背景色设置为RGB值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18685772/

相关文章:

java - 如何在我的 Eclipse 中打印控制台值?

C# 发布 .exe 并使用 cmd 向其发送参数

sql-server - 如何使用 PowerShell 监控进程的 CPU 使用率?

azure - 如何在 Azure PowerShell 中获取所有资源参数详细信息

c++ - 如何让用户使用 OpenCV 选择视频录制设备(网络摄像头)?

.net - console.writeline 线程安全吗?

powershell - Office 365 session 室邮箱 CalendarProcessing 通过 Microsoft Graph 访问

powershell - 从脚本中的 powershell 命令获取退出代码并将其传递给 Jenkins

powershell - 如何从powershell中的get-mobiledevicestatistics获取准确的用户名

c# - 尝试循环回到控制台应用程序的开头