How to define classification formats for each theme

痴心易碎 提交于 2019-12-07 03:35:54

问题


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.

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.


回答1:


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.

The Visual F# Power Tools use this approach, which I discovered from this answer.



来源:https://stackoverflow.com/questions/22453969/how-to-define-classification-formats-for-each-theme

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!