From 8dd9e1a71a708f66f7ad2685bd717eb044c3acaf Mon Sep 17 00:00:00 2001 From: chuan Date: Thu, 21 May 2026 23:35:28 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=BC=BA=E5=A4=B1?= =?UTF-8?q?=E8=AF=AD=E6=B3=95=E9=AB=98=E4=BA=AE=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AGENTS.md | 3 +- scripts/verify-generated-theme.ts | 6 +++- styles/tokens/required.ts | 5 ++++ themes/github-dark/index.ts | 2 +- themes/github-dark/syntax-colors.ts | 43 ++++++++++++++++++++++++++++ themes/github-light/syntax-colors.ts | 42 ++++++++++++++++++++++++++- 6 files changed, 97 insertions(+), 4 deletions(-) create mode 100644 themes/github-dark/syntax-colors.ts diff --git a/AGENTS.md b/AGENTS.md index 98a873b..6005346 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1 +1,2 @@ -- 和 playwright-mcp 相关操作的临时文件放在文件夹u `.playwright-mcp` 下面 \ No newline at end of file +- 和 playwright-mcp 相关操作的临时文件放在文件夹u `.playwright-mcp` 下面 +- `.gitea` 是 gitea 这个项目的官方源代码 \ No newline at end of file diff --git a/scripts/verify-generated-theme.ts b/scripts/verify-generated-theme.ts index 5bd310f..1a7e8f6 100644 --- a/scripts/verify-generated-theme.ts +++ b/scripts/verify-generated-theme.ts @@ -16,6 +16,8 @@ const requiredSnippets = [ '--theme-version: "1.26.1', "--color-primary: #0969da", "--github-bgColor-accent-emphasis: #0969da", + "--color-syntax-keyword: #cf222e", + "--color-syntax-string: #0a3069", ".ui.primary.button", ".repository.file.list #repo-files-table", ".page-content.user.signin", @@ -29,6 +31,8 @@ const requiredDarkSnippets = [ "--color-body: #0d1117", "--color-text: #e6edf3", "--github-bgColor-accent-emphasis: #1f6feb", + "--color-syntax-keyword: #ff7b72", + "--color-syntax-string: #a5d6ff", ".ui.primary.button", ]; @@ -70,7 +74,7 @@ for (const file of [ } } -for (const file of ["theme-meta.ts", "core.ts", "github-colors.ts", "target-colors.ts", "index.ts"]) { +for (const file of ["theme-meta.ts", "core.ts", "github-colors.ts", "syntax-colors.ts", "target-colors.ts", "index.ts"]) { if (!darkThemeFiles.includes(file)) { throw new Error(`themes/github-dark is missing theme source file: ${file}`); } diff --git a/styles/tokens/required.ts b/styles/tokens/required.ts index bbd25e4..97a5ecb 100644 --- a/styles/tokens/required.ts +++ b/styles/tokens/required.ts @@ -8,6 +8,11 @@ const requiredRootTokens = [ "--color-light-border", "--border-radius", "--github-bgColor-accent-emphasis", + "--color-syntax-keyword", + "--color-syntax-string", + "--color-syntax-comment", + "--color-syntax-number", + "--color-syntax-invalid", "--color-nav-hoverBg", "--color-label-hoverBg", "--color-reaction-hoverBg", diff --git a/themes/github-dark/index.ts b/themes/github-dark/index.ts index ca44d0c..a58e5f0 100644 --- a/themes/github-dark/index.ts +++ b/themes/github-dark/index.ts @@ -2,10 +2,10 @@ import { ansiColorTokens } from "../github-light/ansi-colors"; import { diffColorTokens } from "../github-light/diff-colors"; import { namedColorTokens } from "../github-light/named-colors"; import { semanticColorTokens } from "../github-light/semantic-colors"; -import { syntaxColorTokens } from "../github-light/syntax-colors"; import { consoleTokens } from "./console"; import { coreTokens } from "./core"; import { githubColorTokens } from "./github-colors"; +import { syntaxColorTokens } from "./syntax-colors"; import { targetColorTokens } from "./target-colors"; import { themeMeta } from "./theme-meta"; diff --git a/themes/github-dark/syntax-colors.ts b/themes/github-dark/syntax-colors.ts new file mode 100644 index 0000000..d2a936e --- /dev/null +++ b/themes/github-dark/syntax-colors.ts @@ -0,0 +1,43 @@ +export const syntaxColorTokens = ` +--color-syntax-keyword: #ff7b72; + --color-syntax-bool: #79c0ff; + --color-syntax-control: #ff7b72; + --color-syntax-name: #d2a8ff; + --color-syntax-type: #ffa657; + --color-syntax-number: #79c0ff; + --color-syntax-operator: #79c0ff; + --color-syntax-regexp: #7ee787; + --color-syntax-string: #a5d6ff; + --color-syntax-comment: #8b949e; + --color-syntax-invalid: #f85149; + --color-syntax-link: var(--color-primary); + --color-syntax-tag: #7ee787; + --color-syntax-attribute: #79c0ff; + --color-syntax-property: #79c0ff; + --color-syntax-variable: #ffa657; + --color-syntax-string-special: #a5d6ff; + --color-syntax-escape: #a5d6ff; + --color-syntax-entity: #ffa657; + --color-syntax-preproc: #79c0ff; + --color-syntax-preproc-file: #79c0ff; + --color-syntax-decorator: #d2a8ff; + --color-syntax-namespace: #c9d1d9; + --color-syntax-name-pseudo: #c9d1d9; + --color-syntax-comment-special: #8b949e; + --color-syntax-text: var(--color-text); + --color-syntax-text-alt: var(--color-text); + --color-syntax-punctuation: var(--color-text); + --color-syntax-whitespace: #f85149; + --color-syntax-diff-fg: var(--color-text); + --color-syntax-deleted-bg: #67060c; + --color-syntax-inserted-bg: #033a16; + --color-syntax-emph: var(--color-text); + --color-syntax-strong: var(--color-text); + --color-syntax-heading: #1f6feb; + --color-syntax-subheading: #1f6feb; + --color-syntax-output: var(--color-text); + --color-syntax-prompt: var(--color-text); + --color-syntax-traceback: #f85149; + --color-syntax-matching-bracket-bg: #2f81f766; + --color-syntax-nonmatching-bracket-bg: #f8514933; +`.trim(); diff --git a/themes/github-light/syntax-colors.ts b/themes/github-light/syntax-colors.ts index 18ee161..7ab713e 100644 --- a/themes/github-light/syntax-colors.ts +++ b/themes/github-light/syntax-colors.ts @@ -1,3 +1,43 @@ export const syntaxColorTokens = ` - +--color-syntax-keyword: #cf222e; + --color-syntax-bool: #0550ae; + --color-syntax-control: #cf222e; + --color-syntax-name: #6639ba; + --color-syntax-type: #953800; + --color-syntax-number: #0550ae; + --color-syntax-operator: #0550ae; + --color-syntax-regexp: #116329; + --color-syntax-string: #0a3069; + --color-syntax-comment: #59636e; + --color-syntax-invalid: #82071e; + --color-syntax-link: var(--color-primary); + --color-syntax-tag: #116329; + --color-syntax-attribute: #0550ae; + --color-syntax-property: #0550ae; + --color-syntax-variable: #953800; + --color-syntax-string-special: #0a3069; + --color-syntax-escape: #0a3069; + --color-syntax-entity: #953800; + --color-syntax-preproc: #0550ae; + --color-syntax-preproc-file: #0550ae; + --color-syntax-decorator: #6639ba; + --color-syntax-namespace: #1f2328; + --color-syntax-name-pseudo: #1f2328; + --color-syntax-comment-special: #59636e; + --color-syntax-text: var(--color-text); + --color-syntax-text-alt: var(--color-text); + --color-syntax-punctuation: var(--color-text); + --color-syntax-whitespace: #82071e; + --color-syntax-diff-fg: var(--color-text); + --color-syntax-deleted-bg: var(--color-diff-removed-row-bg); + --color-syntax-inserted-bg: var(--color-diff-added-row-bg); + --color-syntax-emph: var(--color-text); + --color-syntax-strong: var(--color-text); + --color-syntax-heading: #0550ae; + --color-syntax-subheading: #0550ae; + --color-syntax-output: var(--color-text); + --color-syntax-prompt: var(--color-text); + --color-syntax-traceback: #82071e; + --color-syntax-matching-bracket-bg: #0969da33; + --color-syntax-nonmatching-bracket-bg: #cf222e33; `.trim();