cscode 颜色定制

保存一个C代码阅读的颜色方案。

如何却动 scope?

按 F1,搜索 developer:inspect editor tokens and scopes

之后点击代码中你要修改颜色的地方,查看【foreground】处的作用域,复制下来粘贴到【settings.json】"scope"后的引号里,就可以定制指定位置的颜色方案了。

 

 {
      "cmake.configureOnOpen": true,
      "explorer.confirmDelete": false,
      "git.ignoreMissingGitWarning": true,
      "workbench.colorTheme": "Visual Studio Light",
      "security.workspace.trust.untrustedFiles": "open",
      "C_Cpp.default.compilerPath": "C:\\Strawberry\\c\\bin\\g++.exe",
      "redhat.telemetry.enabled": true,
      "workbench.tree.indent": 20,
      "workbench.iconTheme": "vs-minimal",
      "editor.fontSize": 13,
      "cmake.showOptionsMovedNotification": false,
      "workbench.colorCustomizations": {
         "[Visual Studio Light]": {
            "editor.background": "#E0EEE0", // 90EE90  8ae496 背景色
            "sideBar.background": "#cbd6e5", //侧边色
            "activityBar.background": "#4F4F4F", //活动栏颜色
         },
      },
      "editor.tokenColorCustomizations": {
         "comments": "#808080", // 注释
         "keywords": "#FF00FF", // 关键字
         "functions": "#000080", // 函数名
         "variables": "#800080", // 变量名
         "numbers": "#ff0000", // 数字
         "types": "#228B22", //  类型
         "strings": "#000000", // 字符串
         "[Visual Studio Light]": {
            "textMateRules": [
               {
                  "scope": [
                     "storage.type.class", //注释
                  ],
                  "settings": {
                     "foreground": "#2F4F4F",
                     "fontStyle": ""
                  }
               },
               {
                  "scope": [
                     "keyword.other", //其他关键字 typedef
                     "keyword.control"
                  ],
                  "settings": {
                     "foreground": "#ff00ff",
                     "fontStyle": "bold"
                  }
               },
               {
                  "scope": [
                     "keyword.control.directive", // 与宏相关的关键字
                     "punctuation.definition.directive", // 与宏相关的关键字符号 "#"
                  ],
                  "settings": {
                     "foreground": "#ff00ff",
                     "fontStyle": "bold"
                  }
               },
               {
                  "scope": [
                     "punctuation.separator.dot-access", //语法符号,视作关键字 符号 "."
                     "punctuation.separator.pointer-access", //语法符号,视作关键字 符号 "->"
                     "keyword.operator", //语法符号,视作关键字 运算符
                  ],
                  "settings": {
                     "foreground": "#ff00ff",
                     "fontStyle": ""
                  }
               },
               {
                  "scope": [
                     "entity.name.function", // 函数名
                     "keyword.operator.sizeof", // 库函数
                  ],
                  "settings": {
                     "foreground": "#000080",
                     "fontStyle": "bold"
                  }
               },
               {
                  "scope": [
                     "variable.parameter", // 形参,视作函数的一部分
                  ],
                  "settings": {
                     "foreground": "#000080",
                     "fontStyle": ""
                  }
               },
               {
                  "scope": [
                     "variable.other.global", //全局变量
                  ],
                  "settings": {
                     "foreground": "#0000EE",
                     "fontStyle": "bold"
                  }
               },
               {
                  "scope": [
                     "variable.other.local", // 局部变量
                     "variable.other.property", // 结构体的字段
                     "variable.parameter.c",
                     "punctuation", //一般的标点符号
                  ],
                  "settings": {
                     "foreground": "#4876FF",
                     "fontStyle": "bold"
                  }
               },
               {
                  "scope": [
                     "entity.name.function.preprocessor", // 宏定义
                  ],
                  "settings": {
                     "foreground": "#CD3333",
                     "fontStyle": ""
                  }
               },
               {
                  "scope": [
                     "constant.numeric", // 数值
                     "variable.other.enummember" //枚举值
                  ],
                  "settings": {
                     "foreground": "#ff0000",
                     "fontStyle": "italic"
                  }
               },
               {
                  "scope": [
                     "storage.type.built-in.primitive.c", //自带的类型
                     "storage.type", // struct关键字
                     "storage.modifier", // const, static
                  ],
                  "settings": {
                     "foreground": "#228B22",
                     "fontStyle": ""
                  }
               },
               {
                  "scope": [
                     "string"
                  ],
                  "settings": {
                     "foreground": "#000000",
                     "fontStyle": "",
                  }
               },
               {
                  "scope": [
                     "string.quoted.double.include",
                     "string.quoted.other.lt-gt.include", //头文件
                     "constant",
                  ],
                  "settings": {
                     "foreground": "#0000FF",
                     "fontStyle": ""
                  }
               },
            ],
         },
      },
   }

 

posted @ 2024-12-17 17:36  Biiigfish  阅读(1)  评论(0编辑  收藏  举报