如何在 C# 中获得 PC 的模式(亮/暗)? [英] How do I get the mode (Light/Dark) of the PC in C#?
问题描述
我目前正在开发 WPF 应用程序.我注意到新的 Windows 更新带来了一些很酷的功能,其中之一是暗模式.当我将 PC 设置为暗模式时,Google Chrome 和 Firefox 也变暗了.我想知道它实际上是如何发生的,以及如何通过 C# 找到当前模式.
I am currently working on a WPF app. I've noticed that the new windows update brought some cool features, one of them is dark mode. When I set my PC to dark mode, Google Chrome and Firefox became dark as well. I'd like to know how it actually happens and how can I find the current mode via C#.
推荐答案
浅色/深色是主题.您可以检查注册表 获取 Windows 主题?
Light/dark are themes. You could check the registry Get Windows theme?
如果这不是一个选项.
您可以获取 wpf 系统画笔的颜色并检查其值.
You could get the colour of a wpf system brush and check it's value.
https://devblogs.microsoft.com/wpf/systemcolors-reference/一个>
这篇关于如何在 C# 中获得 PC 的模式(亮/暗)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!