diff --git a/apps/web/src/lib/wechat-copy.test.mjs b/apps/web/src/lib/wechat-copy.test.mjs index 80171800..e37048fc 100644 --- a/apps/web/src/lib/wechat-copy.test.mjs +++ b/apps/web/src/lib/wechat-copy.test.mjs @@ -80,13 +80,16 @@ describe("preparePublishArticle", () => { "--note-palette-accent": "#B39AE8", "--note-palette-light-accent": "#7351CF", "--note-palette-text": "#3F3F46", + "--note-palette-code-text": "#5B4EE0", })[name] ?? "", }); try { const context = readEditorCopyContext(container); expect(context.colors.accent).toBe("#7351CF"); - const root = preparePublishArticle("

重点

", container); + const root = preparePublishArticle("

重点 Cmd/Ctrl + E

", container); expect(css(root.querySelector("strong"))).toContain("color:#7351CF"); + expect(css(root.querySelector("code"))).toContain("color:#3d4450"); + expect(css(root.querySelector("code"))).toContain("background:#f3f5f7"); } finally { globalThis.getComputedStyle = previous; } diff --git a/apps/web/src/lib/wechat-copy.ts b/apps/web/src/lib/wechat-copy.ts index 5bf55295..902292f0 100644 --- a/apps/web/src/lib/wechat-copy.ts +++ b/apps/web/src/lib/wechat-copy.ts @@ -58,9 +58,9 @@ const applyLegacyWeChatStyles = ( const fontSize = `${metrics.fontSize}px`; const lineHeight = String(metrics.lineHeight); const codeSize = `${noteProseCodeFontSize(metrics.fontSize)}px`; - // A named hue only recolors links, inline code, and bold, matching the editor. + // A named hue only recolors links and bold, matching the editor. const link = colors?.link ?? LINK_COLOR; - const inlineCodeColor = colors?.codeText ?? CODE_COLOR; + const inlineCodeColor = CODE_COLOR; const accent = colors?.accent ?? BODY_COLOR; const bold = colors ? `font-weight: 800; color: ${accent};` : "font-weight: 800;"; const textStyle = `font-family: ${PUBLISH_FONT}; font-size: ${fontSize}; line-height: ${lineHeight}; letter-spacing: -0.005em; color: ${BODY_COLOR};`; diff --git a/apps/web/src/styles/editor-typography.test.mjs b/apps/web/src/styles/editor-typography.test.mjs index 136c8c62..e2df0269 100644 --- a/apps/web/src/styles/editor-typography.test.mjs +++ b/apps/web/src/styles/editor-typography.test.mjs @@ -81,15 +81,17 @@ describe("editor typography contract", () => { expect(prose).not.toContain('data-note-palette="custom"'); }); - test("named palettes recolor links, inline code, bold, and checked task boxes", () => { + test("named palettes recolor links, bold, and checked task boxes while code stays neutral", () => { const prose = readStyle("./note-prose.css"); expect(prose).toMatch(/color:\s*var\(--note-palette-link\)/); - expect(prose).toMatch(/color:\s*var\(--note-palette-code-text\)/); + expect(prose).not.toMatch(/--note-palette-code-text/); expect(prose).toMatch(/color:\s*var\(--note-palette-accent\)/); expect(prose).toMatch(/accent-color:\s*var\(--note-palette-accent\)/); expect(prose).toMatch(/ul\[data-type="taskList"\] li\[data-checked\] > label input/); - expect(prose).toMatch(/\.edgeever-code-block code/); + expect(prose).not.toMatch(/\.ProseMirror (?:code|pre code)/); + const globals = readStyle("./globals.css"); + expect(declarationsForSelector(globals, ".ProseMirror code")).toContain("color: #3d4450;"); expect(prose).not.toMatch(/--note-palette-text/); expect(prose).not.toMatch(/--note-palette-surface/); expect(prose).not.toMatch(/--note-palette-muted/); diff --git a/apps/web/src/styles/note-prose.css b/apps/web/src/styles/note-prose.css index 6dc3802e..a03aa8b3 100644 --- a/apps/web/src/styles/note-prose.css +++ b/apps/web/src/styles/note-prose.css @@ -1,4 +1,4 @@ -/* Named hues tint links, inline code, bold, and checked task boxes. Body, quotes, rules, tables, and code chrome stay native. */ +/* Named hues tint links, bold, and checked task boxes. Body, quotes, rules, tables, and code stay native. */ :root.dark .edgeever-editor[data-note-palette]:not([data-note-palette="native"]) { /* Override the light accent supplied by inline account prose variables. */ --note-palette-accent: var(--note-palette-dark-accent) !important; @@ -23,15 +23,6 @@ accent-color: var(--note-palette-accent); } -.edgeever-editor[data-note-palette]:not([data-note-palette="native"]) .ProseMirror code { - color: var(--note-palette-code-text); -} - -.edgeever-editor[data-note-palette]:not([data-note-palette="native"]) .ProseMirror pre code, -.edgeever-editor[data-note-palette]:not([data-note-palette="native"]) .ProseMirror .edgeever-code-block code { - color: inherit; -} - :root.dark .edgeever-editor[data-note-palette]:not([data-note-palette="native"]) .ProseMirror a:not(.edgeever-attachment-link) { color: var(--note-palette-accent); text-decoration-color: color-mix(in srgb, var(--note-palette-accent) 45%, transparent); @@ -42,12 +33,3 @@ text-decoration-color: var(--note-palette-accent); } -:root.dark .edgeever-editor[data-note-palette]:not([data-note-palette="native"]) .ProseMirror code { - color: var(--note-palette-accent); -} - -:root.dark .edgeever-editor[data-note-palette]:not([data-note-palette="native"]) .ProseMirror pre code, -:root.dark .edgeever-editor[data-note-palette]:not([data-note-palette="native"]) .ProseMirror .edgeever-code-block code { - color: inherit; -} - diff --git a/packages/shared/src/i18n/en-US.ts b/packages/shared/src/i18n/en-US.ts index 9c1af001..ad6f77c3 100644 --- a/packages/shared/src/i18n/en-US.ts +++ b/packages/shared/src/i18n/en-US.ts @@ -1023,12 +1023,12 @@ export const enUS = { editorBodyPalettes: { native: "Native", clay: "Vermilion orange", - dawn: "Gold", - teal: "Teal", + dawn: "Ochre gold", + teal: "Jade teal", azure: "Royal blue", - violet: "Purple", - pink: "Pink", - slate: "Gray", + violet: "Iris purple", + pink: "Rose pink", + slate: "Mauve gray", }, editorBodyCssTitle: "Custom CSS", editorBodyCssDescription: "One stylesheet. Light rules set spacing and color, and the following :root.dark rules only override color. Size and line height stay on the controls above.", diff --git a/packages/shared/src/i18n/ja.ts b/packages/shared/src/i18n/ja.ts index 39f2b330..fdc39cb6 100644 --- a/packages/shared/src/i18n/ja.ts +++ b/packages/shared/src/i18n/ja.ts @@ -1012,12 +1012,12 @@ export const ja = { editorBodyPalettes: { native: "標準", clay: "朱橙", - dawn: "金", - teal: "青緑", + dawn: "オーカーゴールド", + teal: "ジェイドティール", azure: "ロイヤルブルー", - violet: "紫", - pink: "ピンク", - slate: "グレー", + violet: "アイリスパープル", + pink: "ローズピンク", + slate: "モーヴグレー", }, editorBodyCssTitle: "カスタム CSS", editorBodyCssDescription: "スタイルは1つです。ライトで間隔と色を書き、直後の :root.dark は色だけを上書きします。文字サイズと行間はここでは指定しません。", diff --git a/packages/shared/src/i18n/pl.ts b/packages/shared/src/i18n/pl.ts index 3dcd3a5d..acd326e7 100644 --- a/packages/shared/src/i18n/pl.ts +++ b/packages/shared/src/i18n/pl.ts @@ -1012,12 +1012,12 @@ export const pl = { editorBodyPalettes: { native: "Natywne", clay: "Cynobrowy pomarańcz", - dawn: "Złoty", - teal: "Morski", + dawn: "Ochrowe złoto", + teal: "Jadeitowy turkus", azure: "Królewski błękit", - violet: "Fioletowy", - pink: "Różowy", - slate: "Szary", + violet: "Irysowy fiolet", + pink: "Różany róż", + slate: "Szarość z fioletem", }, editorBodyCssTitle: "Własny CSS", editorBodyCssDescription: "Jeden arkusz stylów. Reguły jasne ustawiają odstępy i kolory, a następujące po nich reguły :root.dark nadpisują tylko kolory. Rozmiar i interlinia pozostają w ustawieniach powyżej.", diff --git a/packages/shared/src/i18n/zh-CN.ts b/packages/shared/src/i18n/zh-CN.ts index 00be2290..7e6ce653 100644 --- a/packages/shared/src/i18n/zh-CN.ts +++ b/packages/shared/src/i18n/zh-CN.ts @@ -1023,12 +1023,12 @@ export const zhCN = { editorBodyPalettes: { native: "原生", clay: "朱橙", - dawn: "金色", - teal: "青色", + dawn: "赭金", + teal: "碧青", azure: "宝蓝", - violet: "紫色", - pink: "粉色", - slate: "灰色", + violet: "鸢紫", + pink: "玫粉", + slate: "灰紫", }, editorBodyCssTitle: "自定义 CSS", editorBodyCssDescription: "同一份样式。浅色写间距和颜色,紧随的 :root.dark 只覆盖颜色。字号和行高不写在这里。",