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

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

Closed
2percentsilk opened this issue Jan 24, 2017 · 6 comments
Closed

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

2percentsilk opened this issue Jan 24, 2017 · 6 comments
Assignees
Projects

Comments

@2percentsilk
Copy link

@2percentsilk 2percentsilk commented Jan 24, 2017

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
Copy link
Contributor

@grokys 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 added a commit that referenced this issue Feb 16, 2017
- 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
@2percentsilk
Copy link
Author

@2percentsilk 2percentsilk commented Feb 16, 2017

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

@grokys grokys self-assigned this Feb 20, 2017
@prasethu
Copy link
Collaborator

@prasethu 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
Copy link
Contributor

@grokys 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
Copy link
Collaborator

@prasethu 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
Copy link
Collaborator

@prasethu 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
Projects
Linked pull requests

Successfully merging a pull request may close this issue.

4 participants
You can’t perform that action at this time.