Skip to content

HC fixes#1994

Merged
niels9001 merged 4 commits intomainfrom
niels9001/hc-fixes
Jul 30, 2025
Merged

HC fixes#1994
niels9001 merged 4 commits intomainfrom
niels9001/hc-fixes

Conversation

@niels9001
Copy link
Collaborator

@niels9001 niels9001 commented Jul 30, 2025

  • Added a fixed foreground color for the home page header.
  • Back ported the complete SubtleButtonStyle coming in WASDK1.8 so the right brushes are used in HC mode

Fixes #1952
Fixes #1878

Before:
image

image

After:
image

image

@niels9001 niels9001 requested review from Copilot and marcelwgn July 30, 2025 15:11
@niels9001 niels9001 enabled auto-merge (squash) July 30, 2025 15:11
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request addresses high contrast (HC) accessibility issues by implementing proper theming for buttons and headers. The changes ensure that UI elements display correctly in high contrast mode by providing appropriate color brushes for different visual states.

  • Backported complete SubtleButtonStyle from WASDK1.8 with proper high contrast brush support
  • Added explicit foreground color brushes for the home page header across all theme modes
  • Enhanced button styling with proper border brush definitions and visual state management

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
WinUIGallery/Styles/Button.xaml Implements comprehensive theming dictionaries for SubtleButtonStyle with HC-specific brushes and enhanced visual states
WinUIGallery/Controls/HomePage/HomePageHeader.xaml Adds fixed foreground color brushes for header text elements across Light, Dark, and HighContrast themes

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Comment on lines +11 to +22
<StaticResource x:Key="SubtleButtonBackground" ResourceKey="SubtleFillColorTransparentBrush" />
<StaticResource x:Key="SubtleButtonBackgroundPointerOver" ResourceKey="SubtleFillColorSecondaryBrush" />
<StaticResource x:Key="SubtleButtonBackgroundPressed" ResourceKey="SubtleFillColorTertiaryBrush" />
<StaticResource x:Key="SubtleButtonBackgroundDisabled" ResourceKey="SubtleFillColorTransparentBrush" />
<StaticResource x:Key="SubtleButtonForeground" ResourceKey="TextFillColorPrimaryBrush" />
<StaticResource x:Key="SubtleButtonForegroundPointerOver" ResourceKey="TextFillColorPrimaryBrush" />
<StaticResource x:Key="SubtleButtonForegroundPressed" ResourceKey="TextFillColorSecondaryBrush" />
<StaticResource x:Key="SubtleButtonForegroundDisabled" ResourceKey="TextFillColorDisabledBrush" />
<StaticResource x:Key="SubtleButtonBorderBrush" ResourceKey="SubtleFillColorTransparentBrush" />
<StaticResource x:Key="SubtleButtonBorderBrushPointerOver" ResourceKey="SubtleFillColorSecondaryBrush" />
<StaticResource x:Key="SubtleButtonBorderBrushPressed" ResourceKey="SubtleFillColorTertiaryBrush" />
<StaticResource x:Key="SubtleButtonBorderBrushDisabled" ResourceKey="SubtleFillColorTransparentBrush" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why exactly do we need to add all of those brushes just to fix the red background in HC?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really know 😅.. I think it has to do with that we were referring to existing brushes in WinUI that do not have a HC version (only light/dark).

I've now copied the SubtleButtonStyle from WinUI that has this properly set up.

When we upgrade to 1.8 we can remove this style + folks that want to copy it into their own app have a style that adheres to the WinUI styles convention.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A simpler fix would be to not reference colors but brushes (and appending brush to the SubtleX colors for background actually fixes it). Colors in WinUI for some reason tend to point to a Red color in High Contrast, dont ask me why. Not a big fan of copying the entire style but I guess its just temporary.

@marcelwgn
Copy link
Contributor

/azp run

@niels9001 niels9001 merged commit 888f8e3 into main Jul 30, 2025
2 checks passed
@niels9001 niels9001 deleted the niels9001/hc-fixes branch July 30, 2025 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants