Quantcast
Channel: Visual Studio Integrate forum
Viewing all articles
Browse latest Browse all 4410

How to retrieve VS 2017/ 2019 code syntax colours

$
0
0

I am building an advanced editor for VS 2017 / 2019 for a solution I'm creating.  I want total control over the editor itself, including embedding it inside of other WPF controls as part of an overall UX experience.

As such, the editor has code styling, as in, all elements in a .cs file (namespace, using statements, comments, public private abstract etc., braces, loops, what have you) have specific colours which should be applied.

One of the things which is important is to maintain the same colours as defined by the user / theme the user has chosen.

Now, for all the environment colours (that is, all aspects of VS which are not the contents of the editor window), these are easily obtained via the method

VSColorTheme.GetThemedColor(themeResourceKey);

Using the predefined themeResourceKeys as defined in

Microsoft.VisualStudio.PlatformUI.EnvironmentColors

So, for example, to retrieve the background color key for the tool window background, you call the following

VSColorTheme.GetThemedColor(EnvironmentColors.ToolWindowBackgroundColorKey);

What I am after is the keys of the colors being used by VS to color class names, comments, line number, privates, publics, statics, etc, all colors used in the editor. With these color keys, I'd like to then use these code keys to call a VS extensibility class or method to retrieve the actual colours being used.

Does anyone have any knowledge on how the editor is retrieving these actual color keys, and how I can use these to retrieve the currently set color?

Thanks



Viewing all articles
Browse latest Browse all 4410

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>