Skip to content
This repository was archived by the owner on Jun 5, 2025. It is now read-only.

Commit 2e3956c

Browse files
authored
Fix HighContrast issues in Widgets and WhatsNewPage (#2522)
1 parent 4966d25 commit 2e3956c

File tree

5 files changed

+66
-19
lines changed

5 files changed

+66
-19
lines changed

src/App.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<ResourceDictionary Source="/Styles/WindowTitleBar_ThemeResources.xaml" />
1717

1818
<!-- Resources from other projects -->
19+
<ResourceDictionary Source="ms-appx:///DevHome.Dashboard/Styles/Dashboard_ThemeResources.xaml" />
1920
<ResourceDictionary Source="ms-appx:///DevHome.SetupFlow/Styles/SetupFlow_ThemeResources.xaml" />
2021
<ResourceDictionary Source="ms-appx:///DevHome.Common/Environments/Styles/HorizontalCardStyles.xaml" />
2122
</ResourceDictionary.MergedDictionaries>

src/Views/WhatsNewPage.xaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
<Color x:Key="ButtonAccentForeground">#000000</Color>
3030
<Color x:Key="LearnMoreForeground">#60CDFF</Color>
3131
</ResourceDictionary>
32+
<ResourceDictionary x:Key="HighContrast">
33+
<x:String x:Key="Background">/Assets/WhatsNewPage/DarkTheme/Background.png</x:String>
34+
</ResourceDictionary>
3235
</ResourceDictionary.ThemeDictionaries>
3336
</ResourceDictionary>
3437
</Page.Resources>

tools/Dashboard/DevHome.Dashboard/Controls/WidgetControl.xaml

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,14 @@
55
x:Class="DevHome.Dashboard.Controls.WidgetControl"
66
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
77
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
8-
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
9-
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
108
xmlns:helpers="using:DevHome.Dashboard.Helpers"
11-
mc:Ignorable="d"
129
AutomationProperties.Name="{x:Bind WidgetSource.WidgetDisplayTitle}">
1310

14-
<UserControl.Resources>
15-
<ResourceDictionary>
16-
<ResourceDictionary.ThemeDictionaries>
17-
<ResourceDictionary x:Key="Light">
18-
<Color x:Key="WidgetBorderColor">#0F000000</Color>
19-
<Color x:Key="WidgetBackgroundColor">#B4FFFFFF</Color>
20-
</ResourceDictionary>
21-
<ResourceDictionary x:Key="Dark">
22-
<Color x:Key="WidgetBorderColor">#1A000000</Color>
23-
<Color x:Key="WidgetBackgroundColor">#0CFFFFFF</Color>
24-
</ResourceDictionary>
25-
</ResourceDictionary.ThemeDictionaries>
26-
</ResourceDictionary>
27-
</UserControl.Resources>
28-
2911
<Grid Width="300" Height="{x:Bind helpers:WidgetHelpers.GetPixelHeightFromWidgetSize(WidgetSource.WidgetSize), Mode=OneWay}"
30-
CornerRadius="7" BorderBrush="{ThemeResource WidgetBorderColor}" Background="{ThemeResource WidgetBackgroundColor}" BorderThickness="1">
12+
CornerRadius="7"
13+
BorderBrush="{ThemeResource WidgetCardBorderBrush}"
14+
Background="{ThemeResource WidgetCardBackground}"
15+
BorderThickness="1">
3116
<Grid.RowDefinitions>
3217
<RowDefinition Height="36" />
3318
<RowDefinition Height="*" />

tools/Dashboard/DevHome.Dashboard/DevHome.Dashboard.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<ItemGroup>
1212
<None Remove="Assets\HostConfigDark.json" />
1313
<None Remove="Assets\HostConfigLight.json" />
14+
<None Remove="Styles\Dashboard_ThemeResources.xaml" />
1415
<None Remove="Views\AddWidgetDialog.xaml" />
1516
<None Remove="Views\DashboardView.xaml" />
1617
<None Remove="Views\WidgetControl.xaml" />
@@ -31,6 +32,7 @@
3132
<ProjectReference Include="..\..\..\common\DevHome.Common.csproj" />
3233
<Content Include=".\BuildAssets\Microsoft.Windows.Widgets.Internal.winmd" Link="Microsoft.Windows.Widgets.Internal.winmd" CopyToOutputDirectory="PreserveNewest" />
3334
<Content Include=".\BuildAssets\Microsoft.Windows.Widgets.winmd" Link="Microsoft.Windows.Widgets.winmd" CopyToOutputDirectory="PreserveNewest" />
35+
<Content Include="Styles\Dashboard_ThemeResources.xaml" CopyToOutputDirectory="PreserveNewest" />
3436
</ItemGroup>
3537

3638
<ItemGroup>
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<ResourceDictionary
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
4+
<ResourceDictionary.ThemeDictionaries>
5+
<ResourceDictionary x:Key="Default">
6+
<StaticResource x:Key="WidgetCardBackground" ResourceKey="CardBackgroundFillColorDefaultBrush" />
7+
<StaticResource x:Key="WidgetCardBackgroundPointerOver" ResourceKey="ControlFillColorSecondaryBrush" />
8+
<StaticResource x:Key="WidgetCardBackgroundPressed" ResourceKey="ControlFillColorTertiaryBrush" />
9+
<StaticResource x:Key="WidgetCardBackgroundDisabled" ResourceKey="ControlFillColorDisabledBrush" />
10+
11+
<StaticResource x:Key="WidgetCardForeground" ResourceKey="TextFillColorPrimaryBrush" />
12+
<StaticResource x:Key="WidgetCardForegroundPointerOver" ResourceKey="TextFillColorPrimaryBrush" />
13+
<StaticResource x:Key="WidgetCardForegroundPressed" ResourceKey="TextFillColorSecondaryBrush" />
14+
<StaticResource x:Key="WidgetCardForegroundDisabled" ResourceKey="TextFillColorDisabledBrush" />
15+
16+
<StaticResource x:Key="WidgetCardBorderBrush" ResourceKey="CardStrokeColorDefaultBrush" />
17+
<StaticResource x:Key="WidgetCardBorderBrushPointerOver" ResourceKey="ControlElevationBorderBrush" />
18+
<StaticResource x:Key="WidgetCardBorderBrushPressed" ResourceKey="ControlStrokeColorDefaultBrush" />
19+
<StaticResource x:Key="WidgetCardBorderBrushDisabled" ResourceKey="ControlStrokeColorDefaultBrush" />
20+
</ResourceDictionary>
21+
22+
<ResourceDictionary x:Key="Light">
23+
<StaticResource x:Key="WidgetCardBackground" ResourceKey="CardBackgroundFillColorDefaultBrush" />
24+
<StaticResource x:Key="WidgetCardBackgroundPointerOver" ResourceKey="ControlFillColorSecondaryBrush" />
25+
<StaticResource x:Key="WidgetCardBackgroundPressed" ResourceKey="ControlFillColorTertiaryBrush" />
26+
<StaticResource x:Key="WidgetCardBackgroundDisabled" ResourceKey="ControlFillColorDisabledBrush" />
27+
28+
<StaticResource x:Key="WidgetCardForeground" ResourceKey="TextFillColorPrimaryBrush" />
29+
<StaticResource x:Key="WidgetCardForegroundPointerOver" ResourceKey="TextFillColorPrimaryBrush" />
30+
<StaticResource x:Key="WidgetCardForegroundPressed" ResourceKey="TextFillColorSecondaryBrush" />
31+
<StaticResource x:Key="WidgetCardForegroundDisabled" ResourceKey="TextFillColorDisabledBrush" />
32+
33+
<StaticResource x:Key="WidgetCardBorderBrush" ResourceKey="CardStrokeColorDefaultBrush" />
34+
<StaticResource x:Key="WidgetCardBorderBrushPointerOver" ResourceKey="ControlElevationBorderBrush" />
35+
<StaticResource x:Key="WidgetCardBorderBrushPressed" ResourceKey="ControlStrokeColorDefaultBrush" />
36+
<StaticResource x:Key="WidgetCardBorderBrushDisabled" ResourceKey="ControlStrokeColorDefaultBrush" />
37+
</ResourceDictionary>
38+
39+
<ResourceDictionary x:Key="HighContrast">
40+
<StaticResource x:Key="WidgetCardBackground" ResourceKey="SystemColorButtonFaceColorBrush" />
41+
<StaticResource x:Key="WidgetCardBackgroundPointerOver" ResourceKey="SystemColorHighlightTextColorBrush" />
42+
<StaticResource x:Key="WidgetCardBackgroundPressed" ResourceKey="SystemColorHighlightTextColorBrush" />
43+
<StaticResource x:Key="WidgetCardBackgroundDisabled" ResourceKey="SystemControlBackgroundBaseLowBrush" />
44+
45+
<StaticResource x:Key="WidgetCardForeground" ResourceKey="SystemColorButtonTextColorBrush" />
46+
<StaticResource x:Key="WidgetCardForegroundPointerOver" ResourceKey="SystemColorHighlightColorBrush" />
47+
<StaticResource x:Key="WidgetCardForegroundPressed" ResourceKey="SystemColorHighlightColorBrush" />
48+
<StaticResource x:Key="WidgetCardForegroundDisabled" ResourceKey="SystemControlDisabledBaseMediumLowBrush" />
49+
50+
<StaticResource x:Key="WidgetCardBorderBrush" ResourceKey="SystemColorButtonTextColorBrush" />
51+
<StaticResource x:Key="WidgetCardBorderBrushPointerOver" ResourceKey="SystemColorHighlightColorBrush" />
52+
<StaticResource x:Key="WidgetCardBorderBrushPressed" ResourceKey="SystemColorHighlightTextColorBrush" />
53+
<StaticResource x:Key="WidgetCardBorderBrushDisabled" ResourceKey="SystemControlDisabledTransparentBrush" />
54+
</ResourceDictionary>
55+
</ResourceDictionary.ThemeDictionaries>
56+
</ResourceDictionary>

0 commit comments

Comments
 (0)