无法在 Uno 2.4 上更改 WASM 的强调颜色 [英] Cannot Change Accent Color for WASM on Uno 2.4

查看:32
本文介绍了无法在 Uno 2.4 上更改 WASM 的强调颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 App.xaml 中定义了一个新的强调色,如下所示:

I defined a new accent color in App.xaml lke this:

Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
            </ResourceDictionary.MergedDictionaries>
            <Color x:Key="SystemAccentColor">#FFCB2128</Color>
            <Color x:Key="AcmGreen">#FFB8C282</Color>
            <Color x:Key="AcmPink">#FFE672A4</Color>
            <Color x:Key="AcmPurple">#FF71749E</Color>
            <Thickness x:Key="PivotItemMargin">0</Thickness>

        </ResourceDictionary>

    </Application.Resources>

它适用于 UWP 应用:

It works on UWP app:

但是,在 WASM 页面 (Edge Chromium - 81.0.416.77) 上,Accent Color 保持默认的蓝色

However, Accent Color stays default blue on WASM Page (Edge Chromium - 81.0.416.77)

WASM 上的强调色与 App.xaml 中定义的 UWP 版本不匹配.它应该是.我该如何解决这个问题?

The accent color on WASM do not match with UWP version which defined in App.xaml. It should be. How can I fix this?

Nuget 包:

软件包版本:

  • Uno.UI.RemoteControl {2.4.0}
  • Uno.Wasm.Bootstrap {1.2.0}
  • Uno.Wasm.Bootstrap.DevServer {1.2.0}
  • Microsoft.Extensions.Logging.Filter {1.1.2}
  • Microsoft.Extensions.Logging.Con... {1.1.1}
  • NETStandard.Library {2.0.3}
  • Uno.UI {2.4.0}
  • Microsoft.NETCore.UniversalWindo... {6.2.10}
  • Microsoft.Extensions.Logging.Con... {1.1.1}
  • Microsoft.Extensions.Logging.Filter {1.1.2}
  • Microsoft.UI.Xaml {2.4.0}
  • Uno.Core {2.0.0}

推荐答案

Uno 很快将支持以这种方式全局修改主题颜色,当 此 PR 已合并.

Globally modifying theme colors this way will be supported in Uno soon, when this PR is merged.

现在,如果您想使用 Uno 修改配色方案,则需要针对每个控件进行修改.例如对于 ToggleSwitch 你会:

For now if you want to modify the color scheme with Uno, you will need to do it per control. For instance for ToggleSwitch you would:

  1. 复制ToggleSwitch 的样式 放入应用中的 ResourceDictionary 文件中(通常放入名为 ToggleSwitch.xaml 的独立文件中).
  2. 将其包含在 App.xaml
  3. Application.Resources
  4. 修改样式中设置切换开关背景的部分.(它看起来像 这一行:Fill="{ThemeResource SystemControlHighlightAccentBrush}")
  1. Copy the style for ToggleSwitch into a ResourceDictionary file in your app (typically into a standalone file called ToggleSwitch.xaml).
  2. Include it in Application.Resources in App.xaml
  3. Modify the part of the style that sets the toggle switch's background. (It looks like this line: Fill="{ThemeResource SystemControlHighlightAccentBrush}")

这篇关于无法在 Uno 2.4 上更改 WASM 的强调颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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