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

Publish to GitHub button in TE does not support high contrast #796

Closed
abuchholtzau opened this Issue Jan 24, 2017 · 6 comments

Comments

Projects
4 participants
@abuchholtzau

Steps

  1. Set Windows 10 to High Contrast mode
  2. Open VS
  3. Click publish button in the bottom right corner of VS
  4. Look at the GitHub option

scr_rc5lf4d0 zuh

@paladique paladique added the bug label Jan 25, 2017

@grokys grokys added this to Not Started in 2.2.0.8 Feb 2, 2017

@grokys

This comment has been minimized.

Show comment
Hide comment
@grokys

grokys Feb 16, 2017

Contributor

Hi @abuchholtzau,

Yes this is currently failing because we're using a hack to detect the current VS theme and mistakenly identifying the high-contrast theme for a light theme.

The code to detect the current theme is here:

https://github.com/github/VisualStudio/blob/master/src/GitHub.VisualStudio.UI/Colors.cs#L35

There must be a better way to detect the current VS theme, but all I've found from googling are methods that involve reading a registry key, which strikes me as rather non-future-proof. How should we be detecting the current theme?

Contributor

grokys commented Feb 16, 2017

Hi @abuchholtzau,

Yes this is currently failing because we're using a hack to detect the current VS theme and mistakenly identifying the high-contrast theme for a light theme.

The code to detect the current theme is here:

https://github.com/github/VisualStudio/blob/master/src/GitHub.VisualStudio.UI/Colors.cs#L35

There must be a better way to detect the current VS theme, but all I've found from googling are methods that involve reading a registry key, which strikes me as rather non-future-proof. How should we be detecting the current theme?

@grokys grokys added the cosmetic label Feb 16, 2017

grokys added a commit that referenced this issue Feb 16, 2017

Refactor Button styling.
- Remove `GitHubButton` style - this was the default style for all our
buttons, but wasn't used anywhere. It appears to be the default style in
GHfW but doesn't fit with Visual Studio. By removing this default style,
buttons in Team Explorer use the default button style - fixes #796.
- Make `GitHubVsButton` the default style for buttons in the GitHub
pane. We only currently have one button that's not a primary button
("Cancel" in the PR creation view) but it should be the default style
for subsequent buttons there, so removed the style from that individual
button and made it apply to all buttons.

@grokys grokys moved this from Not Started to In Progress in 2.2.0.8 Feb 16, 2017

@abuchholtzau

This comment has been minimized.

Show comment
Hide comment
@abuchholtzau

abuchholtzau Feb 16, 2017

@prasethu can you help advise a better way to detect the VS theme?

@prasethu can you help advise a better way to detect the VS theme?

@grokys grokys self-assigned this Feb 20, 2017

@prasethu

This comment has been minimized.

Show comment
Hide comment
@prasethu

prasethu Feb 21, 2017

Collaborator

@abuchholtzau @grokys The right way to do this would be to apply the Platform button style in XAML directly on your button.

<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:vsfx="clr-namespace: Microsoft.VisualStudio.Shell;assembly=Microsoft.VisualStudio.Shell.15.0"> <Button Style="{DynamicResource {x:Static vsfx:VsResourceKeys.ButtonStyleKey}}" /> </UserControl>

Collaborator

prasethu commented Feb 21, 2017

@abuchholtzau @grokys The right way to do this would be to apply the Platform button style in XAML directly on your button.

<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:vsfx="clr-namespace: Microsoft.VisualStudio.Shell;assembly=Microsoft.VisualStudio.Shell.15.0"> <Button Style="{DynamicResource {x:Static vsfx:VsResourceKeys.ButtonStyleKey}}" /> </UserControl>

@grokys

This comment has been minimized.

Show comment
Hide comment
@grokys

grokys Feb 21, 2017

Contributor

Thanks @prasethu, it turns out we were overriding the default button style. Removing our overridden default button styled fixed it.

It would still be useful if there was a decent way to detect the current theme, but that's now a separate issue.

Contributor

grokys commented Feb 21, 2017

Thanks @prasethu, it turns out we were overriding the default button style. Removing our overridden default button styled fixed it.

It would still be useful if there was a decent way to detect the current theme, but that's now a separate issue.

@grokys grokys closed this in #868 Feb 24, 2017

@prasethu

This comment has been minimized.

Show comment
Hide comment
@prasethu

prasethu Feb 24, 2017

Collaborator

@grokys Why do you want to know what the current theme is? Your code should be agnostic to themes because we can add or change themes as we please.

Collaborator

prasethu commented Feb 24, 2017

@grokys Why do you want to know what the current theme is? Your code should be agnostic to themes because we can add or change themes as we please.

@prasethu

This comment has been minimized.

Show comment
Hide comment
@prasethu

prasethu Feb 24, 2017

Collaborator

@grokys If this is specific to HighContrast, then there is the standard way:
SystemParameters.HighContrast

Collaborator

prasethu commented Feb 24, 2017

@grokys If this is specific to HighContrast, then there is the standard way:
SystemParameters.HighContrast

@paladique paladique moved this from In Progress to Done in 2.2.0.8 Feb 24, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment