✨ feat(vscode): 预览里代码的上色和卡片种类色跟着当前颜色主题走

This commit is contained in:
cruldra committed 2026-10-13 11:27:24 +11:00
1 parent 19302bbed0
commit dff38ee0c5
26 files changed
+1286 -75

No files matched your search

@@ -1,33 +1,7 @@
@import "tailwindcss";
/* 词性与块种类的配色:暗色(含高对比)取 VS Code Dark+,亮色取 Light+。其余界面颜色一律用 --vscode-* 变量。 */
/* 词性与块种类的配色(--cr-keyword 这些、--cr-kind-*)由扩展端按当前颜色主题算好发来,设在 body 上(codeColors.ts)。其余界面颜色一律用 --vscode-* 变量。 */
body {
--cr-keyword: #c586c0;
--cr-storage: #569cd6;
--cr-variable: #9cdcfe;
--cr-function: #dcdcaa;
--cr-type: #4ec9b0;
--cr-string: #ce9178;
--cr-number: #b5cea8;
--cr-comment: #6a9955;
--cr-constant: #4fc1ff;
--cr-kind-import: #c586c0;
--cr-kind-function: #dcdcaa;
--cr-kind-type: #4ec9b0;
--cr-kind-enum: #b180d7;
--cr-kind-exception: #f14c4c;
--cr-kind-data: #9cdcfe;
--cr-kind-branch: #ce9178;
--cr-kind-loop: #8f9cff;
--cr-kind-error: #f48771;
--cr-kind-return: #89d185;
--cr-kind-statement: #9d9d9d;
--cr-kind-comment: #6a9955;
--cr-kind-options: #e5c07b;
--cr-kind-command: #d7ba7d;
--cr-kind-stage: #56b6c2;
margin: 0;
font-family: var(--vscode-font-family, system-ui, sans-serif);
font-size: var(--vscode-font-size, 13px);
@@ -35,36 +9,8 @@ body {
background: var(--vscode-editor-background);
}
body.vscode-light,
body.vscode-high-contrast-light {
--cr-keyword: #af00db;
--cr-storage: #0000ff;
--cr-variable: #001080;
--cr-function: #795e26;
--cr-type: #267f99;
--cr-string: #a31515;
--cr-number: #098658;
--cr-comment: #008000;
--cr-constant: #0070c1;
--cr-kind-import: #af00db;
--cr-kind-function: #795e26;
--cr-kind-type: #267f99;
--cr-kind-enum: #652d90;
--cr-kind-exception: #cd3131;
--cr-kind-data: #001080;
--cr-kind-branch: #a31515;
--cr-kind-loop: #4f56d6;
--cr-kind-error: #b5452f;
--cr-kind-return: #388a34;
--cr-kind-statement: #6f6f6f;
--cr-kind-comment: #008000;
--cr-kind-options: #9a6a00;
--cr-kind-command: #7c5f12;
--cr-kind-stage: #127f8c;
}
/* 种类颜色:同一类语义共用一个颜色,图标区分具体是哪种(kindIcons.tsx)。卡片取自己的种类,子层取所属块的种类 */
/* 种类颜色:同一类语义共用一个颜色(每类查主题的哪个范围见扩展端 theme/codeColors.ts,主题给几类配了同一个色就同色),
图标区分具体是哪种(kindIcons.tsx)。卡片取自己的种类,子层取所属块的种类 */
:is([data-kind="import"], [data-kind="copy"]) { --kind: var(--cr-kind-import); }
[data-kind="function"] { --kind: var(--cr-kind-function); }
:is([data-kind="class"], [data-kind="type"]) { --kind: var(--cr-kind-type); }