question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Update background color of selected Tree View item to meet contrast ratio requirement

See original GitHub issue

Describe the bug

Selected TreeViewItems do not currently meet the 3:1 contrast ratio requirement relative to unselected items, as specified in MAS 1.4.11 - Non-text Contrast.

Light theme ratio is 1.5:1 image

Dark theme ratio is 1.3:1 image

Additional context

This issue is closely related to #2908 but requires different theme resources to be updated.

Proposed fix Create new resources

<RevealBackgroundBrush x:Key="SystemControlHighlightAccent1RevealBackgroundBrush" TargetTheme="Dark" Color="{ThemeResource SystemAccentColorDark1}" FallbackColor="{ThemeResource SystemAccentColorDark1}" />
<RevealBackgroundBrush x:Key="SystemControlHighlightAccent1RevealBackgroundBrush" TargetTheme="Light" Color="{ThemeResource SystemAccentColorLight1}" FallbackColor="{ThemeResource SystemAccentColorLight1}" />

Update TreeViewItemBackgroundSelected to use the new SystemControlHighlightAccent1RevealBackgroundBrush.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
Felix-Devcommented, Jul 16, 2020

Yep, I am asking @YuliKl for this reason (and consistency reasons) to consider switching the currently used TreeViewItem selected brushes to the ones used by the ListViewItem. If we won’t do that, @dpaulino, you can always override those brushes yourself as shown in that issue (while waiting for a fix which would presumably have to wait until WinUI 3).

0reactions
YuliKlcommented, Mar 18, 2021

Closing this issue. TreeView styles and colors are being updated in the near future.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to change TreeViewItem background color according ...
I would like to change the background of any TreeViewItem according to its bound data property "IsHiglighted". I would like to set the...
Read more >
How to change the Background property of a selected ...
Hi all, I would like to change the Background color of selected items of ListViewItems. Many tries but no result. Only replacing the...
Read more >
Accessibility contrast requirements explained and how to ...
The color contrast ratio for both the icon and dark grey circle and the dark grey circle and light grey background is 6.38:1,...
Read more >
Improving colour contrast ratios in Atom
Using the Select element tool, inspect the tree view background and filenames and note which colours they use for display.
Read more >
ANDI - Modules
Suggested Color: If the contrast ratio does not meet the minimum requirement, and there is no semi-transparency involved c ANDI will suggest color...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found