I'm building a syntax highlighting extension for the Properties language in Visual Studio and already built the classifier/tagger. I'm stuck however at setting/choosing the right colors for the different tags (i.e. keys, values, comments).
I'd like to make the colors follow the current theme of Visual Studio. Right now they're hard-coded (see ForegroundColor = ...
):
[Export(typeof(EditorFormatDefinition))]
[ClassificationType(ClassificationTypeNames = "PropertiesKeyTypeDefinition")]
[Name("PropertiesKeyFormat")]
[Order(Before = Priority.Default)]
internal sealed class PropertiesKey : ClassificationFormatDefinition {
public PropertiesKey() {
DisplayName = "Properties Key";
ForegroundColor = Color.FromRgb(86, 156, 214);
}
}
What I've found so far:
- This question presumes my question is already answered.
- This answer shows where in the registry the colors could be stored, but that's not a reliable solution.
- This question addresses colors for WPF (not my case)
- There's the Extensibility Tools extension with the Theme Swatches which show the colors from EnvironmentColors, however I don't know how to use the C# code it provides
If possible, I'd like to use the colors used for 'Keyword', 'String' and 'Comment' colors which can be found in VS in Tools -> Options -> Environment -> Fonts and Colors
, again, in accordance with the current theme.