-
-
Notifications
You must be signed in to change notification settings - Fork 44
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
Get the users current theme programatically (VS2019-2022) #460
Comments
If you can get the editor background color, you can then figure out if you need to use light or dark colors using this utility function: ContrastComparisonResult contrast = ColorUtilities.CompareContrastWithBlackAndWhite(brush.Color); |
Defining a color category with color definitions might be able to handle this, and would allow users to modify the colors. Take a look at #414 (yet to be merged). If you used "automatic" color that was backed by a |
Also note that there are more theme options than just light and dark. |
I'm not sure if this fits your problem, but in You can listen on VSColorTheme.ThemeChanged += VSColorTheme_ThemeChanged; and easily read some variables in there via private void VSColorTheme_ThemeChanged(ThemeChangedEventArgs e)
{
var themedColor = VSColorTheme.GetThemedColor(EnvironmentColors.ToolWindowBackgroundColorKey);
} |
@Matt-17 That helped, thanks! |
Hi,
I maintain a VSIX extension that provides syntax highlighting provided through classifiers. When running the extensions for the first time I ask the user what VS theme they are currently using and apply colors based on their input.
Now I want to do this automatically without user input - get the users current theme (Light/Dark). I found some online information about this but it seems deprecated or outdated - or I'm missing something
How can this be achieved?
Thanks
The text was updated successfully, but these errors were encountered: