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

Resolve correct System Default Theme #394

Open
niemyjski opened this issue Nov 29, 2022 · 2 comments
Open

Resolve correct System Default Theme #394

niemyjski opened this issue Nov 29, 2022 · 2 comments

Comments

@niemyjski
Copy link

In visual studio there is the option for the theme to track the system default theme which returns a guid of {619dac1e-8220-4bd9-96fb-75ceb61a6107} This is not accounted for here: https://github.com/VsixCommunity/Community.VisualStudio.Toolkit/blob/master/demo/VSSDK.TestExtension/ToolWindows/ThemeWindow/ThemeWindowControlViewModel.cs#L21-L44 What's the best solution to resolve light or dark theme based on this?

@reduckted
Copy link
Contributor

reduckted commented Dec 1, 2022

You'll probably need to ask Windows what the system theme is. This StackOverflow question has some suitable solutions.

This one checks the value of the registry key (0 = dark; 1 = light).

This one is a bit of a hack, but I've confirmed that it works. It uses the Microsoft.Windows.SDK.Contracts package to get the color values for the foreground and background and uses them to determine whether the theme is dark or light.

@niemyjski
Copy link
Author

Thanks for that, shouldn't this library also resolve this properly as without it you won't get the correct theme and this theme is the default for VS

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

No branches or pull requests

2 participants