Search:Vscode 如何自定义Python代码高亮

 

参考:白月黑羽的python教程网站

不太习惯Dark主题,然而又没有找到合适的Light Theme

IDLE Shell的高亮倒是不错,可是VScode 的插件里没搜到

上网搜索,感谢B站up白月黑羽的分享,

最终使用[Atom One Light]主题,添加自定义高亮,虽然没有完全如idle高亮

但是改了一些字体颜色后,清晰多了


 

示例:

操作记录:

设置——工作区——外观——编辑 json 添加代码

 

 

指定类型的代码高亮设置:

 

 

 

添加自定义代码:

 

            {  //自定义 数字常量

              "scope"

              [

                "constant.numeric"  //注意要有""

              ],

              "settings"

              {

                  "foreground""#ebb82c",

                  "fontStyle""bold"

              }

            }, //间隔有逗号

 

 

 


[Atom One Light]主题的基础上自定义全部代码:

{
    "workbench.colorCustomizations": {
        "[Atom One Light]": {
          // activity bar
          "activityBar.border": "#e9e1e1",
          "activityBar.background": "#104057",
          "activityBar.foreground": "#dd447e",
          "activityBar.inactiveForeground": "#6cb8db",
          "activityBarBadge.background": "#d73a49",
          // sideBar bar
          "sideBar.border": "#e7e4e4",
          "sideBar.background": "#ffffff",
          "sideBar.foreground": "#000000",
          "sideBarSectionHeader.background": "#ffffff",            
          "sideBarSectionHeader.border": "#e1e1e6", 
          // others
          "editorLineNumber.foreground": "#4d5f3c",
          "editorIndentGuide.background": "#e0d6d6",
          "editorIndentGuide.activeBackground": "#ddbebe",
          
        }
      },
      "editor.tokenColorCustomizations": {
        "[Atom One Light]": {
          "comments" : {
            "foreground": "#11c4cadc",
            "fontStyle": "bold"
            },            //注释
          "numbers": {
            "foreground": "#264666",      //数字
            "fontStyle": "bold"
          },      
          "textMateRules": [

            {  //自定义 数字常量
              "scope": 
              [
                "constant.numeric"  //注意要有""
              ],
              "settings": 
              {
                  "foreground": "#ebb82c",
                  "fontStyle": "bold"
              }
            }, //间隔有逗号
            {  //自定义  source.python variable.parameter
              "scope": 
              [
                "source.python variable.parameter"  //
              ],
              "settings": 
              {
                  "foreground": "#eb2c45",
                  "fontStyle": "bold"
              }
            },
            {  //自定义  keyword.operator
              "scope": 
              [
                "keyword.operator"  //
              ],
              "settings": 
              {
                  "foreground": "#ec9e0dc4",
                  "fontStyle": "bold"
              }
            },
            
            {  //自定义 //source.python constant.other
              "scope": 
              [
                "source.python constant.other"  //
              ],
              "settings": 
              {
                  "foreground": "#50A14F",
                  "fontStyle": "bold"
              }
            },
            {  //自定义 string
              "scope": 
              [
                "string"  //
              ],
              "settings": 
              {
                  "foreground": "#0d9c0dde",
                  "fontStyle": "bold"
              }
            },


          ]
        }
      }
}

 

 

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值