Skip to content

Commit 043ed5a

Browse files
authored
Update background color of selected ListView item to meet contrast ratio requirement (#2962)
* Add new SystemControlHighlightListAccentMediumLowBrush theme resource. * Update ListViewItemBackgroundSelected theme resource to consume the previously added SystemControlHighlightListAccentMediumLowBrush theme resource. * Updated ListViewItemBackgroundSelectedPointerOver for dark theme. * Added new SystemControlHighlightListAccentVeryHighBrush theme resource. * Updated ListViewItemBackgroundSelectedPressed to consume the new SystemControlHighlightListAccentVeryHighBrush theme resource.
1 parent ed60131 commit 043ed5a

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

dev/Common/Common_themeresources.xaml

+6
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,26 @@
99
<ResourceDictionary.ThemeDictionaries>
1010
<ResourceDictionary x:Key="Default">
1111
<SolidColorBrush x:Key="SystemControlTransparentBrush" Color="Transparent" />
12+
<SolidColorBrush x:Key="SystemControlHighlightListAccentVeryHighBrush" Color="{ThemeResource SystemAccentColor}" Opacity="0.9" />
13+
<SolidColorBrush x:Key="SystemControlHighlightListAccentMediumLowBrush" Color="{ThemeResource SystemAccentColor}" Opacity="0.75" />
1214
<x:Boolean x:Key="UseSystemFocusVisuals">True</x:Boolean>
1315
<Thickness x:Key="TextControlBorderThemeThickness">1</Thickness>
1416
<Thickness x:Key="TextControlBorderThemeThicknessFocused">2</Thickness>
1517
<Thickness x:Key="TextControlThemePadding">10,6,6,5</Thickness>
1618
</ResourceDictionary>
1719
<ResourceDictionary x:Key="Light">
1820
<SolidColorBrush x:Key="SystemControlTransparentBrush" Color="Transparent" />
21+
<SolidColorBrush x:Key="SystemControlHighlightListAccentVeryHighBrush" Color="{ThemeResource SystemAccentColor}" Opacity="0.9" />
22+
<SolidColorBrush x:Key="SystemControlHighlightListAccentMediumLowBrush" Color="{ThemeResource SystemAccentColor}" Opacity="0.75" />
1923
<x:Boolean x:Key="UseSystemFocusVisuals">True</x:Boolean>
2024
<Thickness x:Key="TextControlBorderThemeThickness">1</Thickness>
2125
<Thickness x:Key="TextControlBorderThemeThicknessFocused">2</Thickness>
2226
<Thickness x:Key="TextControlThemePadding">10,6,6,5</Thickness>
2327
</ResourceDictionary>
2428
<ResourceDictionary x:Key="HighContrast">
2529
<SolidColorBrush x:Key="SystemControlTransparentBrush" Color="Transparent" />
30+
<SolidColorBrush x:Key="SystemControlHighlightListAccentVeryHighBrush" Color="{ThemeResource SystemColorHighlightColor}" />
31+
<SolidColorBrush x:Key="SystemControlHighlightListAccentMediumLowBrush" Color="{ThemeResource SystemColorHighlightColor}" />
2632
<x:Boolean x:Key="UseSystemFocusVisuals">True</x:Boolean>
2733
<Thickness x:Key="TextControlBorderThemeThickness">1</Thickness>
2834
<Thickness x:Key="TextControlBorderThemeThicknessFocused">2</Thickness>

dev/CommonStyles/ListViewItem_themeresources.xaml

+7-7
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
<StaticResource x:Key="ListViewItemBackground" ResourceKey="SystemControlTransparentBrush" />
2121
<StaticResource x:Key="ListViewItemBackgroundPointerOver" ResourceKey="SystemControlHighlightListLowBrush" />
2222
<StaticResource x:Key="ListViewItemBackgroundPressed" ResourceKey="SystemControlHighlightListMediumBrush" />
23-
<StaticResource x:Key="ListViewItemBackgroundSelected" ResourceKey="SystemControlHighlightListAccentLowBrush" />
24-
<StaticResource x:Key="ListViewItemBackgroundSelectedPointerOver" ResourceKey="SystemControlHighlightListAccentMediumBrush" />
25-
<StaticResource x:Key="ListViewItemBackgroundSelectedPressed" ResourceKey="SystemControlHighlightListAccentHighBrush" />
23+
<StaticResource x:Key="ListViewItemBackgroundSelected" ResourceKey="SystemControlHighlightListAccentMediumLowBrush" />
24+
<StaticResource x:Key="ListViewItemBackgroundSelectedPointerOver" ResourceKey="SystemControlHighlightListAccentLowBrush" />
25+
<StaticResource x:Key="ListViewItemBackgroundSelectedPressed" ResourceKey="SystemControlHighlightListAccentVeryHighBrush" />
2626
<StaticResource x:Key="ListViewItemForeground" ResourceKey="SystemControlForegroundBaseHighBrush" />
2727
<StaticResource x:Key="ListViewItemForegroundPointerOver" ResourceKey="SystemControlHighlightAltBaseHighBrush" />
2828
<StaticResource x:Key="ListViewItemForegroundSelected" ResourceKey="SystemControlHighlightAltBaseHighBrush" />
@@ -57,9 +57,9 @@
5757
<StaticResource x:Key="ListViewItemBackground" ResourceKey="SystemControlTransparentBrush" />
5858
<StaticResource x:Key="ListViewItemBackgroundPointerOver" ResourceKey="SystemControlHighlightListLowBrush" />
5959
<StaticResource x:Key="ListViewItemBackgroundPressed" ResourceKey="SystemControlHighlightListMediumBrush" />
60-
<StaticResource x:Key="ListViewItemBackgroundSelected" ResourceKey="SystemControlHighlightListAccentLowBrush" />
60+
<StaticResource x:Key="ListViewItemBackgroundSelected" ResourceKey="SystemControlHighlightListAccentMediumLowBrush" />
6161
<StaticResource x:Key="ListViewItemBackgroundSelectedPointerOver" ResourceKey="SystemControlHighlightListAccentMediumBrush" />
62-
<StaticResource x:Key="ListViewItemBackgroundSelectedPressed" ResourceKey="SystemControlHighlightListAccentHighBrush" />
62+
<StaticResource x:Key="ListViewItemBackgroundSelectedPressed" ResourceKey="SystemControlHighlightListAccentVeryHighBrush" />
6363
<StaticResource x:Key="ListViewItemForeground" ResourceKey="SystemControlForegroundBaseHighBrush" />
6464
<StaticResource x:Key="ListViewItemForegroundPointerOver" ResourceKey="SystemControlHighlightAltBaseHighBrush" />
6565
<StaticResource x:Key="ListViewItemForegroundSelected" ResourceKey="SystemControlHighlightAltBaseHighBrush" />
@@ -116,9 +116,9 @@
116116
<StaticResource x:Key="ListViewItemBackground" ResourceKey="SystemControlTransparentBrush" />
117117
<StaticResource x:Key="ListViewItemBackgroundPointerOver" ResourceKey="SystemControlHighlightListLowBrush" />
118118
<StaticResource x:Key="ListViewItemBackgroundPressed" ResourceKey="SystemControlHighlightListMediumBrush" />
119-
<StaticResource x:Key="ListViewItemBackgroundSelected" ResourceKey="SystemControlHighlightListAccentLowBrush" />
119+
<StaticResource x:Key="ListViewItemBackgroundSelected" ResourceKey="SystemControlHighlightListAccentMediumLowBrush" />
120120
<StaticResource x:Key="ListViewItemBackgroundSelectedPointerOver" ResourceKey="SystemControlHighlightListAccentMediumBrush" />
121-
<StaticResource x:Key="ListViewItemBackgroundSelectedPressed" ResourceKey="SystemControlHighlightListAccentHighBrush" />
121+
<StaticResource x:Key="ListViewItemBackgroundSelectedPressed" ResourceKey="SystemControlHighlightListAccentVeryHighBrush" />
122122
<StaticResource x:Key="ListViewItemForeground" ResourceKey="SystemControlForegroundBaseHighBrush" />
123123
<StaticResource x:Key="ListViewItemForegroundPointerOver" ResourceKey="SystemControlHighlightAltBaseHighBrush" />
124124
<StaticResource x:Key="ListViewItemForegroundSelected" ResourceKey="SystemControlHighlightAltBaseHighBrush" />

0 commit comments

Comments
 (0)