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.
Open your VS editor. Navigate to the upper part of the screen and select File. Now, in the drop-down menu, go to Preferences > Settings. You'll now see the Commonly Used section with a menu on the right-side of the screen, you can access the font from this page or by following the step below.
The code formatting is available in Visual Studio Code through the following shortcuts: On Windows Shift + Alt + F. On Mac Shift + Option + F. On Linux Ctrl + Shift + I.
Download font https://www.dafontfree.net/freefonts-script12-bt-f141942.htm
Install package https://github.com/be5invis/vscode-custom-css
Create new css file ~/.vscode/vs-code-styles.css
Paste in this 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;
}
Go to Code > Preferences > User Settings
// 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"
}
}
]
}
Source: https://gist.github.com/psgganesh/d0815ece4b19ce24dde98e21d55f53f5
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With