如何更改 Visual Studio 代码中的注释字体? [英] How do I change font of comments in visual studio code?
问题描述
在观看了一位著名的python程序员的Sublime3截屏后,我发现以花哨的字体显示代码注释是一个好主意,它让注释更容易区分,让注释阅读更愉快.一个例子如下:
在这个演示中,代码注释以浅色手写字体显示,更容易与真实代码区分开来,保持注释的有趣阅读强>同时.
我浏览了https://code.visualstudio.com/docs/getstarted/但似乎找不到更改代码注释字体的设置.
所以我想知道如何针对普通代码字体设置另一种字体以进行注释.
下载字体https://www.dafontfree.net/freefonts-script12-bt-f141942.htm
安装包https://github.com/be5invis/vscode-custom-css
创建新的css文件sudo nano ~/.vscode/vs-code-styles.css
复制 CSS
/* 为脚本字体设置斜体和注释 */.mtk3、.mtk4 {字体系列:'Script12 BT';字体大小:1.2em;字体样式:正常;颜色:#57a649!重要;}.评论 {字体系列:'Script12 BT';字体样式:斜体;字体大小:1.2em;颜色:#57a649!重要;}.comment:not(.punctuation) {字体系列:'Script12 BT';字体大小:1.5em;颜色:#57a649!重要;}
代码 >首选项用户设置
//在您的用户/工作区设置文件中的某处!....vscode_custom_css.imports": [file:////.vscode/vs-code-styles.css"],vscode_custom_css.policy":真,editor.tokenColorCustomizations":{textMateRules":[{范围":评论",设置":{fontStyle":斜体"}}]}
来源:https://gist.github.com/psgganesh/d0815ece4b19ce24dde98e53f53p> After watching a Sublime3 screencast by a famous python programmer, I found that display code comment in a fancy font is a great idea, which let comment more distinguishable and makes comment reading more pleasant. One example is like below: In this demo, code comment is shown in a light color hand-written like font, making it easier to be distinguished from the real code and keeping the comment fun to read at the same time. I went through https://code.visualstudio.com/docs/getstarted/ but can't seem to find the setting for changing the comment font for code. So I am wondering how to set a another font for comment against normal code font. Download font
https://www.dafontfree.net/freefonts-script12-bt-f141942.htm Install package
https://github.com/be5invis/vscode-custom-css Create new css file
Copy CSS Code > Preferences > User Settings Source: https://gist.github.com/psgganesh/d0815ece4b19ce24dde98e21d55f53f5 这篇关于如何更改 Visual Studio 代码中的注释字体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!sudo nano ~/.vscode/vs-code-styles.css
/* Set italics and comments to the script font */
.mtk3, .mtk4 {
font-family: 'Script12 BT';
font-size: 1.2em;
font-style: normal;
color: #57a649!important;
}
.comment {
font-family: 'Script12 BT';
font-style: italic;
font-size: 1.2em;
color: #57a649!important;
}
.comment:not(.punctuation) {
font-family: 'Script12 BT';
font-size: 1.5em;
color: #57a649!important;
}
// Somewhere in your user / workspace settings file !
.
.
.
.
"vscode_custom_css.imports": ["file:///<PATH TO CSS FILE>/.vscode/vs-code-styles.css"],
"vscode_custom_css.policy": true,
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": "comment",
"settings": {
"fontStyle": "italic"
}
}
]
}