Fix low color contrast of spatial audio caption in dark mode - #2210
Open
HariniMalothu17 wants to merge 1 commit into
Open
Fix low color contrast of spatial audio caption in dark mode#2210HariniMalothu17 wants to merge 1 commit into
HariniMalothu17 wants to merge 1 commit into
Conversation
The "Can only enable spatial audio when sound is on!" caption on the
Sound sample page used Foreground="{ThemeResource SystemColorHotlightColor}".
SystemColorHotlightColor is the hyperlink text color and is not part of
the theme's text-color ramp, so in dark mode the caption renders at a
contrast ratio of ~2.78:1 against the page background - below the 4.5:1
minimum (MAS 1.4.3 - Contrast).
Use the theme-aware TextFillColorSecondaryBrush, which adapts to light
and dark themes and meets the contrast requirement, for this secondary
caption text.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 2620f9d2-ff0f-45b0-aa36-3626abe3e83a
Collaborator
Author
|
/azp run |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On the Sound sample page, the caption "Can only enable spatial audio when sound is on!" under the Enable Spatial Audio checkbox has insufficient color contrast in dark mode.
It used:
SystemColorHotlightColoris the hyperlink text color (it is even described that way in the gallery's ownSamples/Color/brushes.json). It is not part of the theme's text-color ramp, so in dark mode the caption renders at roughly 2.78:1 against the page background - below the 4.5:1 minimum (MAS 1.4.3 - Contrast (Minimum)).Fix
Use the theme-aware
TextFillColorSecondaryBrush, which adapts to light and dark themes and meets the contrast requirement, for this secondary caption text:Foreground="{ThemeResource TextFillColorSecondaryBrush}"One-line change in
SoundPage.xaml. No behavioral change.Repro (before fix)
After the fix, the caption uses a theme-aware secondary text color that passes the contrast requirement in both themes.
Testing
WinUIGallery(Debug/x64) -> 0 errors.