Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: No contrast of the CopyButton in the color guidance page #1554

Merged
merged 7 commits into from
Jun 19, 2024

Conversation

HO-COOH
Copy link
Contributor

@HO-COOH HO-COOH commented May 26, 2024

Description

The CopyButton's PointerOver state is bind to ButtonPressedForeground brush, and it will be white in a dark theme, making the button invisible when hoveed in that page.
image

It should be bind to its Foreground so it remains invisible. So after this fix:
image

Motivation and Context

How Has This Been Tested?

Manual

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

@Jay-o-Way
Copy link
Contributor

Here's a weird idea? What would happen if we remove all of this manual work and reset the button to defaults?! 🤓

@Jay-o-Way
Copy link
Contributor

...On-topic...
On rare occasions, the text foreground of the ColorTile control is overwritten to deal with the background. That is, to prevent white-on-white. Is there a possibility to override the foreground of the CopyButton THROUGH the ColorTile control?

<designguidance:ColorTile
Grid.Column="2"
Background="{ThemeResource TextOnAccentFillColorSelectedTextBrush}"
ColorBrushName="TextOnAccentFillColorSelectedTextBrush"
ColorExplanation="For highlighted text in text entry experiences"
ColorName="Text on Accent / Selected Text"
ColorValue="#FFFFFF (FF, 100%)"
Foreground="Black"
ShowSeparator="False" />

Background of control (TextOnAccentFillColorSelectedTextBrush) is always white, force foreground to black

@HO-COOH
Copy link
Contributor Author

HO-COOH commented Jun 13, 2024

I figured out a way, just set Foreground to Null in the original CopyButton template, then check whether it is override, if it is, then we use it as the PointerOver and Pressed foreground color.

Copy link
Contributor

@Jay-o-Way Jay-o-Way left a comment

Choose a reason for hiding this comment

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

Yay, that works!

@karkarl
Copy link
Collaborator

karkarl commented Jun 13, 2024

/azp run

@karkarl karkarl merged commit a8c885d into microsoft:main Jun 19, 2024
2 checks passed
karkarl pushed a commit that referenced this pull request Jul 15, 2024
<!--- Provide a general summary of your changes in the Title above -->

## Description
The `CopyButton`'s `PointerOver` state is bind to
`ButtonPressedForeground` brush, and it will be white in a dark theme,
making the button invisible when hoveed in that page.

![image](https://github.com/microsoft/WinUI-Gallery/assets/42881734/d5222c86-c313-4055-a24d-fcf3f78c2d4f)

It should be bind to its `Foreground` so it remains invisible. So after
this fix:

![image](https://github.com/microsoft/WinUI-Gallery/assets/42881734/a329465e-5b0a-4c73-bbf9-115df7b08eca)

## How Has This Been Tested?
Manual

## Screenshots (if appropriate):

## Types of changes
<!--- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
karkarl pushed a commit that referenced this pull request Jul 15, 2024
<!--- Provide a general summary of your changes in the Title above -->

## Description
The `CopyButton`'s `PointerOver` state is bind to
`ButtonPressedForeground` brush, and it will be white in a dark theme,
making the button invisible when hoveed in that page.

![image](https://github.com/microsoft/WinUI-Gallery/assets/42881734/d5222c86-c313-4055-a24d-fcf3f78c2d4f)

It should be bind to its `Foreground` so it remains invisible. So after
this fix:

![image](https://github.com/microsoft/WinUI-Gallery/assets/42881734/a329465e-5b0a-4c73-bbf9-115df7b08eca)

## How Has This Been Tested?
Manual

## Screenshots (if appropriate):

## Types of changes
<!--- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants