如何为每个主题定义分类格式 [英] How to define classification formats for each theme
问题描述
在我的编辑器扩展中,我对关键字,标识符等使用自定义分类格式.当然,有一些我可以使用的默认格式,因为随后颜色(用于语法高亮显示)将根据所选主题进行更改.
In my editor extension I use custom classification formats for keywords, identifiers and so on. Of course, there are default formats I could use, because then colors (used by syntax highlighting) will be changed in accordance to the selected theme.
由于我的自定义编辑器还需要其他分类类型(例如标点符号类型),因此当用户配置另一个主题时(例如,从Dark
切换为Blue
主题),这些类型的颜色不会改变. .我想知道如何提供主题特定的格式.
Since my custom editor also needs additional classification types (for instance a punctuation type), colors for those types won´t change when the user configures another theme (by switching from Dark
to Blue
theme, for instance). I would like to know how I can proffer theme-specific formats.
推荐答案
The best approach I have found to support multiple colour schemes (themes) is to hook into the ThemeChanged event and then update your classification types accordingly. Where possible I update my custom colours from predefined VS formats that are similar to my custom formats (e.g. use the standard VS Keyword colours to set the defaults on my custom keyword format), since I know these colours will likely be maintained by any custom themes the user has applied.
a> Visual F#我从此答案中发现的方法.
这篇关于如何为每个主题定义分类格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!