[UWP]“反转的黑色或白色” Win10强调色 [英] [UWP]"inversed black or white" Win10 accent color

查看:146
本文介绍了[UWP]“反转的黑色或白色” Win10强调色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello社区,

我的问题简短:

我的应用程序有控件,他们将SystemControlBackgroundAccentBrush作为背景(一个网格) ,一个CommandBar,...)。

my app has controls, they have the SystemControlBackgroundAccentBrush as background (a Grid, a CommandBar, ...).

但是在那些控件上有文本,在某些AccentColors中,这个文本难以阅读(黄色背景下的白色前景)。

But at those control there is text and at some AccentColors, this Text is hard to read (white Foreground at Yellow Background).

所以我希望文本有一种倒置 - 但只是黑色或白色 -   AccentColor。

So I whish to have the text in a kind of inversed - but just black or white - AccentColor.

例如:

AccentColor =黄色,文字 - >黑色
AccentColor =紫罗兰色,文字 - >白色
AccentColor =灰色,文字 - >白色
AccentColor =粉红色,文字 - >黑色
AccentColor = DarkGreen,文字 - >白色$
AccentColor = LightGreen,文字 - >黑色

AccentColor = Yellow, Text -> Black
AccentColor = Violet, Text -> White
AccentColor = Grey, Text -> White
AccentColor = Pink, Text -> Black
AccentColor = DarkGreen, Text -> White
AccentColor = LightGreen, Text -> Black

这是可能的,如果你去设置 - >个人.->颜色你可以为任何应用程序标题栏设置你的AccentColorfor 。


如果你没有切换AccentColor,那么Text(AppName)的行为完全符合我想要的方式。

This is possible, if you go to Settings->Personal.->Colors you can set your AccentColorfor for any app titlebar.
If you than switch the AccentColor, the Text (the AppName) behaives exactly in the way, I want it.

任何想法,我怎么做到这一点?

Any ideas, how I could achieve that?

推荐答案

嗨  Tobi van Helsinki,

Hi Tobi van Helsinki,

欢迎
到开发通用Windows应用论坛!
 请使用  标记 
发布到此论坛时,谢谢!

您可以使用以下代码获取当前的AccentColor,然后您可以设置根据不同的SystemAccentColor,控件的文本颜色为白色或黑色。

You can use the following code to get the current AccentColor, then you can set the control's text color to white or black according to different SystemAccentColor.

var CurrentAccentColor = Application.Current.Resources["SystemAccentColor"];

祝你好运,

Breeze


这篇关于[UWP]“反转的黑色或白色” Win10强调色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆