最近装了visual studio 2017 comunity版(买不起professional),然后觉得代码风格恶心的一逼,于是想办法把它改了。sublime的风格我觉得很美丽,于是就写了一发。
真的要把人美哭了!弄得我恨不得天天看到这漂亮的代码,天天敲代码。。。
很明显sublime的风格有点花哨,但是貌似比VS2017改过的风格好看一些。。。
打开VS2017,新建一个后缀为.vssettings的源文件,然后敲下以下代码:
<UserSettings>
<ApplicationIdentity version="10.0"/>
<ToolsOptions>
<ToolsOptionsCategory name="Environment" RegisteredName="Environment"/>
</ToolsOptions>
<Category name="Environment_Group" RegisteredName="Environment_Group">
<Category name="Environment_FontsAndColors" Category="{1EDA5DD4-927A-43a7-810E-7FD247D0DA1D}" Package="{DA9FB551-C724-11d0-AE1F-00A0C90FFFC3}" RegisteredName="Environment_FontsAndColors" PackageName="Visual Studio Environment Package">
<PropertyValue name="Version">2</PropertyValue>
<FontsAndColors Version="2.0">
<Categories>
<Category GUID="{A27B4E24-A735-4D1D-B8E7-9716E1E3D8E0}" FontIsDefault="Yes">
<Items>
<Item Name="Plain Text" Foreground="0x00F2F8F8" Background="0x00222827" BoldFont="No"/>
<Item Name="Comment" Foreground="0x005E7175" Background="0x02000000" BoldFont="No"/>
<Item Name="Selected Text" Foreground="0x02000000" Background="0x00D6FF05" BoldFont="No"/>
<Item Name="Brace Matching (Rectangle)" Foreground="0x02000000" Background="0x00193D3E" BoldFont="No"/>
<Item Name="Identifier" Foreground="0x02000000" Background="0x02000000" BoldFont="No"/>
<Item Name="Number" Foreground="0x00FF81AE" Background="0x02000000" BoldFont="No"/>
<Item Name="Operator" Foreground="0x02000000" Background="0x02000000" BoldFont="No"/>
<Item Name="String" Foreground="0x0074DBE6" Background="0x02000000" BoldFont="No"/>
<Item Name="String(C# @ Verbatim)" Foreground="0x001F97FD" Background="0x02000000" BoldFont="No"/>
<Item Name="urlformat" Foreground="0x0092E7FF" Background="0x02000000" BoldFont="No"/>
<Item Name="User Types" Foreground="0x00EFD966" Background="0x02000000" BoldFont="No"/>
<Item Name="User Types(Enums)" Foreground="0x002EE2A6" Background="0x02000000" BoldFont="No"/>
<Item Name="User Types(Interfaces)" Foreground="0x00EFD966" Background="0x02000000" BoldFont="No"/>
<Item Name="User Types(Delegates)" Foreground="0x02000000" Background="0x02000000" BoldFont="No"/>
<Item Name="User Types(Value types)" Foreground="0x00EFD966" Background="0x02000000" BoldFont="No"/>
<Item Name="Indicator Margin" Foreground="0x02000000" Background="0x00222827" BoldFont="No"/>
<Item Name="Line Numbers" Foreground="0x004E4831" Background="0x00182222" BoldFont="No"/>
<Item Name="Preprocessor Keyword" Foreground="0x002EE2A6" Background="0x02000000" BoldFont="No"/>
<Item Name="Keyword" Foreground="0x007226F9" Background="0x02000000" BoldFont="No"/>
<Item Name="XML Doc Comment" Foreground="0x005E7175" Background="0x02000000" BoldFont="No"/>
<Item Name="XML Doc Tag" Foreground="0x005E7175" Background="0x02000000" BoldFont="No"/>
<Item Name="CurrentLineActiveFormat" Foreground="0x00383930" Background="0x00383930" BoldFont="No"/>
<Item Name="CurrentLineInactiveFormat" Foreground="0x00161F1F" Background="0x00161F1F" BoldFont="No"/>
<Item Name="CSS Comment" Foreground="0x005E7175" Background="0x02000000" BoldFont="No"/>
<Item Name="CSS Keyword" Foreground="0x007226F9" Background="0x02000000" BoldFont="No"/>
<Item Name="CSS Property Name" Foreground="0x00EFD966" Background="0x02000000" BoldFont="No"/>
<Item Name="CSS Property Value" Foreground="0x00FF81AE" Background="0x02000000" BoldFont="No"/>
<Item Name="CSS Selector" Foreground="0x002EE2A6" Background="0x02000000" BoldFont="No"/>
<Item Name="CSS String Value" Foreground="0x0074DBE6" Background="0x02000000" BoldFont="No"/>
<Item Name="HTML Attribute" Foreground="0x002EE2A6" Background="0x02000000" BoldFont="No"/>
<Item Name="HTML Attribute Value" Foreground="0x0074DBE6" Background="0x02000000" BoldFont="No"/>
<Item Name="HTML Comment" Foreground="0x005E7175" Background="0x02000000" BoldFont="No"/>
<Item Name="HTML Element Name" Foreground="0x007226F9" Background="0x02000000" BoldFont="No"/>
<Item Name="HTML Entity" Foreground="0x00FF81AE" Background="0x02000000" BoldFont="No"/>
<Item Name="HTML Operator" Foreground="0x007226F9" Background="0x02000000" BoldFont="No"/>
<Item Name="HTML Server-Side Script" Foreground="0x02000000" Background="0x02000000" BoldFont="No"/>
<Item Name="HTML Tag Delimiter" Foreground="0x00F2F8F8" Background="0x02000000" BoldFont="No"/>
<Item Name="Razor Code" Foreground="0x02000000" Background="0x00222827" BoldFont="No"/>
<Item Name="Script Comment" Foreground="0x005E7175" Background="0x02000000" BoldFont="No"/>
<Item Name="Script Identifier" Foreground="0x02000000" Background="0x02000000" BoldFont="No"/>
<Item Name="Script Keyword" Foreground="0x00EFD966" Background="0x02000000" BoldFont="No"/>
<Item Name="Script Number" Foreground="0x00FF81AE" Background="0x02000000" BoldFont="No"/>
<Item Name="Script Operator" Foreground="0x007226F9" Background="0x02000000" BoldFont="No"/>
<Item Name="Script String" Foreground="0x0074DBE6" Background="0x02000000" BoldFont="No"/>
<Item Name="XML Attribute" Foreground="0x00EFD966" Background="0x02000000" BoldFont="No"/>
<Item Name="XML Attribute Quotes" Foreground="0x0074DBE6" Background="0x02000000" BoldFont="No"/>
<Item Name="XML Attribute Value" Foreground="0x0074DBE6" Background="0x02000000" BoldFont="No"/>
<Item Name="XML CData Section" Foreground="0x0074DBE6" Background="0x02000000" BoldFont="No"/>
<Item Name="XML Comment" Foreground="0x005E7175" Background="0x02000000" BoldFont="No"/>
<Item Name="XML Delimiter" Foreground="0x00F2F8F8" Background="0x02000000" BoldFont="No"/>
<Item Name="XML Name" Foreground="0x007226F9" Background="0x02000000" BoldFont="No"/>
<Item Name="XML Text" Foreground="0x00F2F8F8" Background="0x02000000" BoldFont="No"/>
<Item Name="XAML Attribute" Foreground="0x00EFD966" Background="0x02000000" BoldFont="No"/>
<Item Name="XAML Attribute Quotes" Foreground="0x00000000" Background="0x02000000" BoldFont="No"/>
<Item Name="XAML Attribute Value" Foreground="0x0074DBE6" Background="0x02000000" BoldFont="No"/>
<Item Name="XAML CData Section" Foreground="0x0074DBE6" Background="0x02000000" BoldFont="No"/>
<Item Name="XAML Comment" Foreground="0x005E7175" Background="0x02000000" BoldFont="No"/>
<Item Name="XAML Delimiter" Foreground="0x00F2F8F8" Background="0x02000000" BoldFont="No"/>
<Item Name="XAML Markup Extension Class" Foreground="0x0092E7FF" Background="0x02000000" BoldFont="No"/>
<Item Name="XAML Markup Extension Parameter Name" Foreground="0x002EE2A6" Background="0x02000000" BoldFont="No"/>
<Item Name="XAML Markup Extension Parameter Value" Foreground="0x0092E7FF" Background="0x02000000" BoldFont="No"/>
<Item Name="XAML Name" Foreground="0x007226F9" Background="0x02000000" BoldFont="No"/>
<Item Name="XAML Text" Foreground="0x02000000" Background="0x02000000" BoldFont="No"/>
<Item Name="Inactive Selected Text" Foreground="0x02000000" Background="0x00323D3E" BoldFont="No"/>
<Item Name="outlining.square" Foreground="0x00555555" Background="0x00E2E2E2" BoldFont="No"/>
<Item Name="outlining.verticalrule" Foreground="0x00A5A5A5" Background="0x02000000" BoldFont="No"/>
<Item Name="Syntax Error" Foreground="0x003333F8" Background="0x02000000" BoldFont="No"/>
<Item Name="Compiler Error" Foreground="0x00E3BB59" Background="0x02000000" BoldFont="No"/>
<Item Name="Warning" Foreground="0x00008000" Background="0x02000000" BoldFont="No"/>
<Item Name="outlining.collapsehintadornment" Foreground="0x00E8DDD7" Background="0x00182222" BoldFont="No"/>
<Item Name="Collapsible Text" Foreground="0x00808080" Background="0x02000000" BoldFont="No"/>
<Item Name="Excluded Code" Foreground="0x005E7175" Background="0x02000000" BoldFont="No"/>
<Item Name="MarkerFormatDefinition/HighlightedReference" Foreground="0x02000000" Background="0x00635936" BoldFont="No"/>
<Item Name="Breakpoint (Enabled)" Foreground="0x00FFFFFF" Background="0x003333F8" BoldFont="No"/>
<Item Name="Current Statement" Foreground="0x00000000" Background="0x003DC4FF" BoldFont="No"/>
<Item Name="CppEnumSemanticTokenFormat" Foreground="0x02000000" Background="0x02000000" BoldFont="No"/>
<Item Name="CppMemberFieldSemanticTokenFormat" Foreground="0x02000000" Background="0x02000000" BoldFont="No"/>
<Item Name="CppFunctionSemanticTokenFormat" Foreground="0x02000000" Background="0x02000000" BoldFont="No"/>
<Item Name="CppLocalVariableSemanticTokenFormat" Foreground="0x02000000" Background="0x02000000" BoldFont="No"/>
<Item Name="CppMacroSemanticTokenFormat" Foreground="0x02000000" Background="0x02000000" BoldFont="No"/>
<Item Name="CppMemberFunctionSemanticTokenFormat" Foreground="0x002EE2A6" Background="0x02000000" BoldFont="No"/>
<Item Name="CppNamespaceSemanticTokenFormat" Foreground="0x02000000" Background="0x02000000" BoldFont="No"/>
<Item Name="CppParameterSemanticTokenFormat" Foreground="0x02000000" Background="0x02000000" BoldFont="No"/>
<Item Name="CppStaticMemberFieldSemanticTokenFormat" Foreground="0x02000000" Background="0x02000000" BoldFont="No"/>
<Item Name="CppStaticMemberFunctionSemanticTokenFormat" Foreground="0x02000000" Background="0x02000000" BoldFont="No"/>
<Item Name="CppTypeSemanticTokenFormat" Foreground="0x00EFD966" Background="0x02000000" BoldFont="No"/>
<Item Name="CppGlobalVariableSemanticTokenFormat" Foreground="0x02000000" Background="0x02000000" BoldFont="No"/>
</Items>
</Category>
</Categories>
</FontsAndColors>
</Category>
</Category>
</UserSettings>
然后按control+s保存。
点击菜单栏的工具选项,然后选倒数第三个导入导出选项,会弹出一个对话框。
按默认点两次下一步,会问你导入哪个集合,然后你点浏览,找到那个.vssettings的文件选上下一步然后确认就好了。如图:
结束
当然你想要啥主题风格,只要编写对应的settings代码然后导入就行了。网上有很多的现成的设置代码,可以去弄一个过来。比如
Studio-Styles(https://studiostyl.es/)
网站就有很多好看的风格,但你得挂VPN才能看到彩色的效果图呀。
也可以去VS拓展应用商店去找:点工具选项的拓展更新,然后选联机选项,搜索"theme"即可。