简体   繁体   English

在C#代码中获取UWP主题颜色

[英]Get UWP theme colors in C# code

Is it possible to get the current Windows 10 theme colors in UWP app with C# code? 是否可以使用C#代码在UWP应用程序中获取当前的Windows 10主题颜色?

I have found Application.RequestedTheme property but it only tells me if dark och light theme is being used, not the actual colors. 我找到了Application.RequestedTheme 属性,但它只告诉我是否使用了暗och light主题,而不是实际的颜色。

I have seen XAML markup that references theme colors but would like to know the RGB value. 我见过XAML标记,它引用了主题颜色,但想知道RGB值。

看看XAML主题资源 ,你可以使用

Application.Current.Resources["SystemAccentColor"]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM