vscode自定义主题语法及流程

vscode c/c++ 主题 DIY

启用自己的主题(最后步骤)

重启生效
文件–>首选项–>主题–>颜色主题:
在这里插入图片描述
也可以在插件里找到哈

在这里插入图片描述

手把手教你制作

在C:\Users\jlh.vscode\extensions下自己创建一个文件夹
在这里插入图片描述
里面有两个文件和一个文件夹
在这里插入图片描述
具体内容:

package.json:

{"name":"theme-jlh","displayName":"%displayName%","description":"%description%","version":"1.0.0","icon": "x.png",//自己准备一张图片128x128"publisher":"vscode","license":"MIT","engines":{"vscode":"*"},"categories":["Themes"],"contributes":{"themes":[{"id":"JLH","label":"%themeLabel%","uiTheme":"vs-dark","path":"./themes/jlh-color-theme.json"}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}
}

package.nls.json:

{"displayName":"JLH Theme","description":"JLH theme for Visual Studio Code","themeLabel":"JLH"
}

themes/jlh-color-theme.json

DIY请重点关注397-592行,带注解的,自行修改:(函数,注释,枚举,....自定义颜色样式)
高级教程: 如果你想弄清楚,xxx的语法是yyy,是怎么来的(见文章最后),比如:宏的语法是 "scope": "entity.name.function.preprocessor.c",

{"$schema": "vscode://schemas/color-theme","name": "jlh diy theme(c/c++)","colors": {"editor.background": "#1E1E1E","editor.foreground": "#DADADA","editor.inactiveSelectionBackground": "#3A3D41","editorIndentGuide.background": "#404040","editorIndentGuide.activeBackground": "#707070","editor.selectionHighlightBackground": "#ADD6FF26","list.dropBackground": "#383B3D","activityBarBadge.background": "#007ACC","sideBarTitle.foreground": "#BBBBBB","input.placeholderForeground": "#A6A6A6","menu.background": "#303031","menu.foreground": "#CCCCCC","statusBarItem.remoteForeground": "#FFF","statusBarItem.remoteBackground": "#16825D","ports.iconRunningProcessForeground": "#369432","sideBarSectionHeader.background": "#0000","sideBarSectionHeader.border": "#ccc3","tab.lastPinnedBorder": "#ccc3","list.activeSelectionIconForeground": "#FFF","editorLineNumber.foreground": "#2b91af","editorLineNumber.activeForeground": "#2b91af","terminal.inactiveSelectionBackground": "#3A3D41","editorInlayHint.background": "#3E3E3E","editorInlayHint.foreground": "#A9A8A7"},"tokenColors": [{"scope": ["meta.embedded","source.groovy.embedded","string meta.image.inline.markdown",],"settings": {"foreground": "#D4D4D4"}},{"scope": "emphasis","settings": {"fontStyle": "italic"}},{"scope": "strong","settings": {"fontStyle": "bold"}},{"scope": "header","settings": {"foreground": "#000080"}},{"scope": "comment","settings": {"foreground": "#6A9955"}},{"scope": "constant.language","settings": {"foreground": "#569cd6"}},{"scope": ["constant.numeric","variable.other.enummember","keyword.operator.plus.exponent","keyword.operator.minus.exponent"],"settings": {"foreground": "#b5cea8"}},{"scope": "constant.regexp","settings": {"foreground": "#646695"}},{"scope": "entity.name.tag","settings": {"foreground": "#569cd6"}},{"scope": "entity.name.tag.css","settings": {"foreground": "#d7ba7d"}},{"scope": "entity.other.attribute-name","settings": {"foreground": "#9cdcfe"}},{"scope": ["entity.other.attribute-name.class.css","entity.other.attribute-name.class.mixin.css","entity.other.attribute-name.id.css","entity.other.attribute-name.parent-selector.css","entity.other.attribute-name.pseudo-class.css","entity.other.attribute-name.pseudo-element.css","source.css.less entity.other.attribute-name.id","entity.other.attribute-name.scss"],"settings": {"foreground": "#d7ba7d"}},{"scope": "invalid","settings": {"foreground": "#f44747"}},{"scope": "markup.underline","settings": {"fontStyle": "underline"}},{"scope": "markup.bold","settings": {"fontStyle": "bold","foreground": "#569cd6"}},{"scope": "markup.heading","settings": {"fontStyle": "bold","foreground": "#569cd6"}},{"scope": "markup.italic","settings": {"fontStyle": "italic"}},{"scope": "markup.strikethrough","settings": {"fontStyle": "strikethrough"}},{"scope": "markup.inserted","settings": {"foreground": "#b5cea8"}},{"scope": "markup.deleted","settings": {"foreground": "#ce9178"}},{"scope": "markup.changed","settings": {"foreground": "#569cd6"}},{"scope": "punctuation.definition.quote.begin.markdown","settings": {"foreground": "#6A9955"}},{"scope": "punctuation.definition.list.begin.markdown","settings": {"foreground": "#6796e6"}},{"scope": "markup.inline.raw","settings": {"foreground": "#ce9178"}},{"name": "brackets of XML/HTML tags","scope": "punctuation.definition.tag","settings": {"foreground": "#808080"}},{"scope": ["meta.preprocessor","entity.name.function.preprocessor"],"settings": {"foreground": "#569cd6"}},{"scope": "meta.preprocessor.string","settings": {"foreground": "#ce9178"}},{"scope": "meta.preprocessor.numeric","settings": {"foreground": "#b5cea8"}},{"scope": "meta.structure.dictionary.key.python","settings": {"foreground": "#9cdcfe"}},{"scope": "meta.diff.header","settings": {"foreground": "#569cd6"}},{"scope": "storage","settings": {"foreground": "#569cd6"}},{"scope": "storage.type","settings": {"foreground": "#569cd6"}},{"scope": ["storage.modifier","keyword.operator.noexcept"],"settings": {"foreground": "#569cd6"}},{"scope": ["string","meta.embedded.assembly"],"settings": {"foreground": "#ce9178"}},{"scope": "string.tag","settings": {"foreground": "#ce9178"}},{"scope": "string.value","settings": {"foreground": "#ce9178"}},{"scope": "string.regexp","settings": {"foreground": "#d16969"}},{"name": "String interpolation","scope": ["punctuation.definition.template-expression.begin","punctuation.definition.template-expression.end","punctuation.section.embedded"],"settings": {"foreground": "#569cd6"}},{"name": "Reset JavaScript string interpolation expression","scope": ["meta.template.expression"],"settings": {"foreground": "#d4d4d4"}},{"scope": ["support.type.vendored.property-name","support.type.property-name","variable.css","variable.scss","variable.other.less","source.coffee.embedded"],"settings": {"foreground": "#9cdcfe"}},{"scope": "keyword","settings": {"foreground": "#569cd6"}},{"scope": "keyword.control","settings": {"foreground": "#569cd6"}},{"scope": "keyword.operator","settings": {"foreground": "#d4d4d4"}},{"scope": ["keyword.operator.new","keyword.operator.expression","keyword.operator.cast","keyword.operator.sizeof","keyword.operator.alignof","keyword.operator.typeid","keyword.operator.alignas","keyword.operator.instanceof","keyword.operator.logical.python","keyword.operator.wordlike"],"settings": {"foreground": "#569cd6"}},{"scope": "keyword.other.unit","settings": {"foreground": "#b5cea8"}},{"scope": ["punctuation.section.embedded.begin.php","punctuation.section.embedded.end.php"],"settings": {"foreground": "#569cd6"}},{"scope": "support.function.git-rebase","settings": {"foreground": "#9cdcfe"}},{"scope": "constant.sha.git-rebase","settings": {"foreground": "#b5cea8"}},{"name": "coloring of the Java import and package identifiers","scope": ["storage.modifier.import.java","variable.language.wildcard.java","storage.modifier.package.java"],"settings": {"foreground": "#d4d4d4"}},{"name": "this.self","scope": "variable.language","settings": {"foreground": "#569cd6"}},//===================关键字================={"scope": "keyword.control.c","settings": {"foreground": "#2b71f1"  // 控制语句关键字(如 if、else、for 等)}},{"scope": "keyword.control.cpp","settings": {"foreground": "#2b71f1"  // C++ 控制语句关键字}},{"scope": "keyword.operator.word.c","settings": {"foreground": "#2b71f1"  // 操作符关键字(如 sizeof、typedef 等)}},{"scope": "keyword.operator.logical.c","settings": {"foreground": "#ff0000"  // 逻辑操作符关键字(如 &&、|| 等)}},//===================字符串================={"scope": "string.quoted.double.cpp","settings": {"foreground": "#44e9ff"  // 双引号字符串}},{"scope": "string.quoted.single.cpp","settings": {"foreground": "#7bf0ff"  // 单引号字符串}},{"scope": "string.quoted.other.cpp","settings": {"foreground": "#44e9ff"  // 其他类型的字符串}},//===================函数================={"scope": "entity.name.function.c","settings": {"foreground": "#fcff54"  // C 函数名}},{"scope": "entity.name.function.cpp","settings": {"foreground": "#fcff54"  // C++ 函数名}},{"scope": "meta.function-call.c","settings": {"foreground": "#d580f7"  // 函数调用名}},{"scope": "variable.parameter","settings": {"foreground": "#ffd588"  // 函数参数}},//=================== 宏 ================={"scope": "keyword.other.macro.c","settings": {"foreground": "#ff0000"  // 宏定义}},{"scope": "keyword.other.macro.cpp","settings": {"foreground": "#ec0f0f"  // C++ 宏定义}},//===================注释================={"scope": "comment.line.double-slash.c","settings": {"foreground": "#5acf5a7e"  // 单行注释}},{"scope": "comment.block.c","settings": {"foreground": "#5acf5a7e"  // 多行注释}},//===================枚举================={"scope": "entity.name.type.enum.c","settings": {"foreground": "#2b71f1"  // 枚举类型名}},{"scope": "constant.other.enum-member.c","settings": {"foreground": "#f0d08c"  // 枚举成员}},//===================指针运算符================={"scope": "storage.modifier.pointer.c","settings": {"foreground": "#e28df3"  // 指针运算符(* 和 &)}},//===================class================={"scope": "entity.name.type.class.cpp","settings": {"foreground": "#2b71f1"  // C++ 类名}},{"scope": "entity.name.type.struct.c","settings": {"foreground": "#2b71f1"  // C 结构体名}},{"scope": "entity.name.type.struct.cpp","settings": {"foreground": "#2b71f1"  // C++ 结构体名}},//===================变量================={"scope": "storage.type.c","settings": {"foreground": "#21c937"  // 类型关键字(如 int、float 等)}},{"scope": "variable.other.readwrite.c","settings": {"foreground": "#bbd1fa"  // 普通变量}},//===================运算符================={"scope": "keyword.operator.arithmetic.c","settings": {"foreground": "#f7f3f3"  // 算术运算符(如 +、-、*、/ 等)}},{"scope": "keyword.operator.comparison.c","settings": {"foreground": "#f7f3f3"  // 比较运算符(如 ==、!=、<、> 等)}},{"scope": "keyword.operator.assignment.c","settings": {"foreground": "#f7f3f3"  // 赋值运算符(如 =、+=、-= 等)}},//===================常量================={"scope": "constant.numeric.integer.c","settings": {"foreground": "#B5CEA8"  // 整数常量}},{"scope": "constant.numeric.float.c","settings": {"foreground": "#B5CEA8"  // 浮点数常量}},{"scope": "constant.character.escape.c","settings": {"foreground": "#CE9178"  // 字符串中的转义字符}}],"semanticHighlighting": true,"semanticTokenColors": {"newOperator": "#569CD6","stringLiteral": "#ce9178","customLiteral": "#DCDCAA","numberLiteral": "#b5cea8"//数字颜色},
/*"editor.semanticTokenColorCustomizations": {"rules": {"namespace": {"foreground": "#569CD6"  // 命名空间},"class": {"foreground": "#4EC9B0"  // 类},"interface": {"foreground": "#4EC9B0"  // 接口},"enum": {"foreground": "#4EC9B0"  // 枚举},"enumMember": {"foreground": "#569CD6"  // 枚举成员},"struct": {"foreground": "#4EC9B0"  // 结构体},"typeParameter": {"foreground": "#9CDCFE"  // 类型参数},"function": {"foreground": "#DCDCAA"  // 函数},"method": {"foreground": "#569CD6"  // 方法},"variable": {"foreground": "#9CDCFE"  // 变量},"parameter": {"foreground": "#9CDCFE"  // 参数},"property": {"foreground": "#9CDCFE"  // 属性},"macro": {"foreground": "#FFD700"  // 宏}}}*/
}

字体加粗/下划线/斜体

"editor.tokenColorCustomizations": {"textMateRules": [{"scope": "keyword.control.c","settings": {"foreground": "#0000FF","fontStyle": "bold"  // 加粗关键字}}]
}
"editor.tokenColorCustomizations": {"textMateRules": [{"scope": "variable.parameter","settings": {"foreground": "#FF00FF","fontStyle": "underline"  // 函数参数加下划线}}]
}
"editor.tokenColorCustomizations": {"textMateRules": [{"scope": "comment.line.double-slash.c","settings": {"foreground": "#008000","fontStyle": "italic"  // 注释文字斜体}}]
}
"editor.tokenColorCustomizations": {"textMateRules": [{"scope": "keyword.other.macro.c","settings": {"foreground": "#FFD700","fontStyle": "bold italic"  // 宏定义加粗且斜体}}]
}

问题,发现有的配置不生效?(语法规则自查)

比如我实现的宏keyword.other.macro.c,没用生效.

检查作用域:
1 按 Ctrl+Shift+P 打开命令面板。
2 输入并执行 Developer: Inspect Editor Tokens and Scopes。
3 将光标放在宏定义上(如 #define),查看实际的作用域
在这里插入图片描述
修改:

        {"scope": "entity.name.function.preprocessor.c","settings": {"foreground": "#ff0000"  // 宏定义}},{"scope": "entity.name.function.preprocessor","settings": {"foreground": "#ec0f0f"  // C++ 宏定义}},

具体问题,具体分析.
其他:也可能是插件冲突,或者被vscode默认主题覆盖

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.pswp.cn/bicheng/84570.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

前端传递日期范围(开始时间和结束时间),后端解析及查询

前端技术&#xff1a;Vue3 TypeScript Element Plus 后端技术&#xff1a;Java Spring Boot MyBatis 应用效果&#xff1a; 原来方案 1、前端日期控件使用 el-date-picker&#xff0c;日期显示格式和日期值返回格式都为&#xff1a;YYYY-MM-DD <el-form :model"…

零基础设计模式——行为型模式 - 命令模式

第四部分&#xff1a;行为型模式 - 命令模式 (Command Pattern) 接下来&#xff0c;我们学习行为型模式中的命令模式。这个模式能将“请求”封装成一个对象&#xff0c;从而让你能够参数化客户端对象&#xff0c;将请求排队或记录请求日志&#xff0c;以及支持可撤销的操作。 …

禁止 Windows 更新后自动重启

Windows 默认会在安装重要更新后自动重启&#xff0c;但你可以调整设置来避免这种情况&#xff1a; ​​方法 1&#xff1a;通过组策略&#xff08;适用于 Windows 专业版/企业版&#xff09;​​ 按 Win R&#xff0c;输入 gpedit.msc 打开 ​​本地组策略编辑器​​。导航…

GoldenDB简述

GoldenDB是国产的分布式数据库。它彻底解决了事务一致性&#xff0c;数据实时一致性的问题。采用的是Shared Nothing&#xff08;分片式存储&#xff09;的分布式架构。就是不共享数据&#xff0c;各自节点持有各自的数据。对比不共享的&#xff0c;还有其他两种分布式架构&…

训练过程中的 Loss ?

文章目录 在我们训练的过程中&#xff0c;设置好这个epochs也就是训练的轮次&#xff0c;然后计算这个损失函数&#xff0c;我们可以知道这个具体的训练的情况&#xff0c;那么在训练的过程中&#xff0c;这个损失函数的变化有哪些情况&#xff1f;对应的一个解释情况是怎么样的…

S2B2B农产品供应链交易多平台开发有哪些发展前景?如何维护?

一、S2B2B农产品供应链交易多平台开发的未来发展前景 本文将由小编为您介绍关于S2B2B农产品供应链交易多平台开发的内容&#xff0c;希望能够帮助大家。在数字化时代&#xff0c;农产品供应链的数字化转型成为了一种必然趋势。S2B2B(Supplier to Business to Business)模式通过…

关于有害的过度使用 std::move

翻译&#xff1a;2023 11 月 24 日On harmful overuse of std::move cppreference std::move 论 std::move 的有害过度使用 - The Old New Thing C 的 std::move 函数将其参数转换为右值引用&#xff0c;这使得其内容可以被另一个操作“消费”&#xff08;移动&#xff09;。…

Ubuntu24.04 onnx 模型转 rknn

前面的环境配置有点懒得写&#xff0c;教程也很多&#xff0c;可以自己找 rknn-toolkit2 gitee 地址&#xff1a;pingli/rknn-toolkit2 试了很多开源的代码&#xff0c;都没办法跑通&#xff0c; 最后自己改了一版 微调后的 qwen2 模型适用 from rknn.api import RKNN impor…

Electron通信流程

前言 今天讲Electron框架的通信流程&#xff0c;首先我们需要知道为什么需要通信。这得益于Electron的多进程模型&#xff0c;它主要模仿chrome的多进程模型如下图&#xff1a; 作为应用开发者&#xff0c;我们将控制两种类型的进程&#xff1a;主进程和渲染器进程 。 …

uni-app项目实战笔记1--创建项目和实现首页轮播图功能

ps:本笔记来自B站咸虾米壁纸项目 一.创建项目&#xff0c;完成项目初始化搭建 1.在HBuilder X创建wallper项目&#xff0c;使用默认模块&#xff0c;选择vue&#xff1b; 2.在项目根目录下创建common目录&#xff0c;用于存放静态资源&#xff0c;创建项目时自动生成static目…

机械制造系统中 PROFINET 与 PROFIBUS-DP 的融合应用及捷米科技解决方案

在机械制造领域&#xff0c;工业通信网络的兼容性与灵活性直接影响产线的自动化水平与生产效率。当前&#xff0c;多数机械制造系统采用PROFINET 控制器构建核心网络架构&#xff0c;并通过微波无线连接实现设备互联。随着工业网络的发展&#xff0c;系统中常需同时集成PROFINE…

MCP 协议系列序言篇:开启 AI 应用融合新时代的钥匙

文章目录 序言&#xff1a;AI 应用层进入 MCP 时代为什么 MCP 开启 AI 应用融合新时代的钥匙为什么是 MCP&#xff1f;它与 Function Calling、Agent 有什么区别&#xff1f;Function CallingAI AgentMCP&#xff08;Model Context Protocol&#xff09; MCP 如何工作MCP Serve…

【threejs】每天一个小案例讲解:光照

代码仓 GitHub - TiffanyHoo/three_practices: Learning three.js together! 可自行clone&#xff0c;无需安装依赖&#xff0c;直接liver-server运行/直接打开chapter01中的html文件 运行效果图 知识要点 常见光照类型及其特点如下&#xff1a; 1. 环境光&#xff08;Ambi…

大模型在输尿管下段积水预测及临床应用的研究

目录 一、引言 1.1 研究背景与意义 1.2 研究目的 1.3 研究范围与限制 1.4 文献综述 1.5 研究方法和框架 二、相关理论与概念 2.1 大模型技术原理 2.2 输尿管下段积水病理机制 2.3 大模型在医学预测领域的应用 三、大模型预测输尿管下段积水的方法 3.1 数据收集 3.…

gitlab相关操作

2025.06.11今天我学习了如何在终端使用git相关操作&#xff1a; 一、需要修改新的仓库git地址的时候&#xff1a; &#xff08;1&#xff09;检查当前远程仓库 git remote -v 输出示例&#xff1a; origin https://github.com/old-repo.git (fetch) origin https://github.c…

51c自动驾驶~合集58

我自己的原文哦~ https://blog.51cto.com/whaosoft/13967107 #CCA-Attention 全局池化局部保留&#xff0c;CCA-Attention为LLM长文本建模带来突破性进展 琶洲实验室、华南理工大学联合推出关键上下文感知注意力机制&#xff08;CCA-Attention&#xff09;&#xff0c;…

通过共享内存在多程序之间实现数据通信

注&#xff1a;以下内容为与 GPT-4O 共同创作完成 以共享内存的方式实现多程序之间的数据通信&#xff0c;尤其适合在一台机器上的多程序之间进行高频数据交换。 以下示例展示了 sender.py 向 receiver.py 发送数据并接收经 receiver.py 处理后的数据&#xff0c;以及如何通过…

[论文阅读] 人工智能+软件工程 | 理解GitGoodBench:评估AI代理在Git中表现的新基准

理解GitGoodBench&#xff1a;评估AI代理在Git中表现的新基准 论文信息 GitGoodBench: A Novel Benchmark For Evaluating Agentic Performance On Git Tobias Lindenbauer, Egor Bogomolov, Yaroslav Zharov Cite as: arXiv:2505.22583 [cs.SE] 研究背景&#xff1a;当AI走进…

开源 java android app 开发(十二)封库.aar

文章的目的为了记录使用java 进行android app 开发学习的经历。本职为嵌入式软件开发&#xff0c;公司安排开发app&#xff0c;临时学习&#xff0c;完成app的开发。开发流程和要点有些记忆模糊&#xff0c;赶紧记录&#xff0c;防止忘记。 相关链接&#xff1a; 开源 java an…

ubuntu + nginx 1.26 + php7.4 + mysql8.0 调优

服务器配置 8核 16G 查看内存 free -h nginx配置 worker_processes auto; # 自动检测CPU核心数 worker_rlimit_nofile 65535; # 提高文件描述符限制 ​ events {worker_connections 8192; # 每个worker的最大连接数multi_accept on; # 一次性接受…