C# console get Windows 10 Accent Color

前端 未结 2 466
滥情空心
滥情空心 2021-01-07 08:27

Is there a way in .Net Core 2.X to read the Selected Windows 10 Accent Color in a Console Application.

Most of the solution i found are UWP or WPF apps.

Too

2条回答
  •  佛祖请我去吃肉
    2021-01-07 09:03

    HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM\ - Stores all decoration colors. So if app launched with rights to HKEY_CURRENT_USER you can read or change "AccentColor" property (and others in directory) or change the color code in hexadecimal notation on your own.

    To get access to windows registry you need to install package: https://www.nuget.org/packages/Microsoft.Windows.Compatibility/

    Here info about package: https://docs.microsoft.com/en-us/dotnet/core/porting/windows-compat-pack/

提交回复
热议问题