如何找出用于 Windows 壁纸的纯色?
问题描述:
我知道如何从注册表中检索壁纸:
I know how to retrieve the wallpaper from the registry:
HKEY_CURRENT_USER\Control Panel\Desktop\Wallpaper
但是如果用户选择使用纯色作为墙纸,我该如何检索该特定颜色呢?
But what if the user chooses to use a solid color as a wallpaper, how do I retrieve that specific color?
答
您可以从中检索它
HKEY_CURRENT_USER\Control Panel\Colors\Background
它是一个包含空格分隔的元组R G B"的字符串,例如255 0 0"代表红色,255 102 0"代表橙色.
It is a string containing a space-seperated tuple "R G B", e.g. "255 0 0" for red, "255 102 0" for orange.
有关获取的信息,请参见此处使用 C#、C++、F# 和 VB.NET 的注册表值.
See here for information on acquiring the registry value using C#, C++, F#, and VB.NET.
以及下面的 Powershell 示例
And the example below for Powershell
# PowerShell Registry Key example
$Registry_Key = "HCU:\Control Panel\Colors\"
Get-ItemProperty -path $Registry_Key -name Background