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
繁體地址,請注明出處:http://hk.pswp.cn/bicheng/84570.shtml
英文地址,請注明出處:http://en.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; # 一次性接受…