VS Code自定义配色方案

VS Code自定义配色方案

VSCode有很多好看的主题插件,在插件搜索框输入theme即可,网上也有大佬们的推荐,但是都不太符合我的审美习惯,所以又花了几天时间研究了一下VSCode的自定义配色tokenColors,这里贴出来我的配色json,主要是针对C语言的,其他语言也类似,注释还是挺详细的,大家可以也根据自己的喜好重新配色。

建议把配置json代码放在全局settings中(Ctrl+Shift+P,输入settings,会看到Open Settings和Open Workspace Settings,分别是全局设置和当前工程的设置),就可以一劳永逸了。

{
    "editor.fontSize": 16,
    "search.exclude": {     //不需要使用搜索的文件
    
        },
    "files.exclude": {      //不需要显示的文件
          "Listings":true,
          "Objects":true
        },
    "window.zoomLevel": 0.5,                      //窗口缩放 默认是0
    "workbench.colorCustomizations":{
        "editor.background": "#181818",         //编辑器背景
        "sideBar.background": "#202020",        //侧边栏背景
        "editor.lineHighlightBackground": "#002535",//光标所在行背景色
        "editor.selectionBackground": "#005585",    //选中内容背景色
        "statusBar.background": "#252525",          //底部状态栏背景色
        "activityBar.background": "#252525",        //最左侧活动栏背景色
        "tab.activeBackground": "#505050",          //活动栏/标签背景色
        "tab.activeForeground": "#e0e0e0",          //活动栏/标签文字颜色
        //"editorBracketMatch.border": "#ff06ff",     //匹配括号框线颜色
        "editorCursor.foreground": "#ffffff",       //光标颜色
        "sideBarSectionHeader.foreground": "#ebebeb",//大纲字体颜色
        "sideBarSectionHeader.background": "#303030",//大纲背景颜色
        "sideBar.foreground": "#c5c5c5",             //侧边栏前景色
    },
    "editor.tokenColorCustomizations": {
        "comments": "#a3a3a3",
        "functions": "#dfdfdf",
        "strings":"#dd4949",
        "numbers": "#377bd4",
        //"keywords": "#ec8b30ee",
        //"variables": "#dfdfdf",
        "textMateRules": [
            //entity.name.function",                    //直接调用的函数
            //entity.name.type",                        //typedef定义的变量
            //keyword.control",                         //if switch break return
            //keyword.operator.assignment",             // =等号/赋值号 |= &=
            //"keyword.operator.logical",               //逻辑符号 && || !
            //"constant.character.escape",              //"\r\n"\
            //constant.other.placeholder",              //"%s %c"
            //punctuation.definition.comment",          // // /*注释开头
            //constant.numeric",                        //数字:50 10  0x20的20部分
            //keyword.operator.word                     //and or not
            //"scope":"meta",                           //括号 函数声明的括号 调用的括号...
            //punctuation.separator",                   //冒号 逗号
            //punctuation.terminator",                  //分号
            //storage.modifier",                        //static const
            //string.quoted.single",                    //单引号字符串
            //string.quoted.double",                    //双引号字符串
            //string.quoted.triple",                    //三引号字符串
            //"storage.type",                           //void int char 
            //"punctuation.definition.string.begin",    //左双引号
            //"punctuation.definition.string.end",      //右双引号
            {
                "scope":"support.function",
                "settings": {
                    "foreground": "#FF0000",
                    "fontStyle": "bold"
                }
            },
            {                                           
                "scope":"entity.name.type",             //typedef定义的变量
                "settings": {
                    "foreground": "#15ced4de",
                }
            },
            {
                "scope":"storage.type",                 //void int char 
                "settings": {
                    "foreground": "#15ced4de",
                }
            },
            {
                "scope":"storage.modifier",             //static const
                "settings": {
                    "foreground": "#15ced4de",
                }
            },
            {
                "scope":"keyword.operator",             //=等号/赋值号 |= &=
                "settings": {
                    "foreground": "#f051a0",
                }
            },
            {
                "scope":"keyword.control",              //if switch break return
                "settings": {
                    "foreground": "#c67ed4",
                    "fontStyle": ""
                }
            },
            {
                "scope":"keyword.operator.logical",       //逻辑符号 && || !
                "settings": {
                    "foreground": "#d6511c",
                    "fontStyle": ""
                }
            },
            {
                "scope":"constant.character.escape",    //"\r\n"
                "settings": {
                    "foreground": "#ee5050",
                    "fontStyle": ""
                }
            },
            {
                "scope":"variable.other",             //结构体对象和成员等
                "settings": {                         //VSCode使用C的颜色限制,这一点比较坑
                    "foreground": "#dfdfdf",          //比如Public.Delay(),颜色是一起变得
                    "fontStyle": ""                   //不能单独设置Public和Delay的显示颜色
                }								      //可能因为VS Code主要用于前端,对C的支持不够完善
            },
            {
                "scope":"variable.parameter",           //函数参数-定义阶段
                "settings": {
                    "foreground": "#dfdfdf",
                    "fontStyle": ""
                }
            },
            {
                "scope":"entity.name.section",          //函数参数-调用阶段
                "settings": {
                    "foreground": "#b66767",
                    "fontStyle": ""
                }
            }
        ]
    }
}

此外推荐一个很漂亮的图标插件 VS Code Great Icons
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_42663377/article/details/109966747