Skip to content

AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.

feat(web): adopt neutral cool gray inline code across all themes and publishing

tianma-if2fc436806795
diff --git a/apps/web/src/lib/wechat-copy.test.mjs b/apps/web/src/lib/wechat-copy.test.mjs
index 31a47ae6..13f1f5d9 100644
--- a/apps/web/src/lib/wechat-copy.test.mjs
+++ b/apps/web/src/lib/wechat-copy.test.mjs
@@ -98,8 +98,9 @@ describe("preparePublishArticle", () => {
"<table><thead><tr><th>表头</th></tr></thead><tbody><tr><td>第1行</td></tr><tr><td>第2行</td></tr></tbody></table>",
].join(""), container);
expect(css(root.querySelector("strong"))).toContain("color:#7351CF");
- expect(css(root.querySelector("code"))).toContain("color:#5B4EE0");
- expect(css(root.querySelector("code"))).toContain("background:#F3F1FF");
+ expect(css(root.querySelector("code"))).toContain("color:#1f2937");
+ expect(css(root.querySelector("code"))).toContain("background:#f3f4f6");
+ expect(css(root.querySelector("code"))).toContain("font-weight:600");
const th = root.querySelector("th");
expect(css(th)).toContain("background:#7351CF");
expect(css(th)).toContain("color:#ffffff");
@@ -142,8 +143,9 @@ describe("preparePublishArticle", () => {
expect(css(body)).toContain("color:#27272a");
expect(css(root.querySelector("strong"))).toContain("font-weight:800");
const inlineCode = body.querySelector("code");
- expect(css(inlineCode)).toContain("color:#3d4450");
- expect(css(inlineCode)).toContain("background:#e9edf1");
+ expect(css(inlineCode)).toContain("color:#1f2937");
+ expect(css(inlineCode)).toContain("background:#f3f4f6");
+ expect(css(inlineCode)).toContain("font-weight:600");
expect(css(root.querySelector("h2"))).toContain("font-weight:600");
expect(css(root.querySelector("h2"))).toContain("color:#27272a");
const [rule, merge] = root.querySelectorAll("hr");
@@ -210,6 +212,8 @@ describe("preparePublishArticle", () => {
expect(css(root.querySelector("u"))).toContain("border-bottom:2px solid #A7F3D0");
expect(css(root.querySelector("mark"))).toContain("background-color:#fde68a");
expect(css(root.querySelector("code"))).toContain("background:#f3f4f6");
+ expect(css(root.querySelector("code"))).toContain("color:#1f2937");
+ expect(css(root.querySelector("code"))).toContain("font-weight:600");
expect(root.querySelector("[data-ee-cover-card]")).toBeNull();
expect(root.querySelector("[data-ee-toc-cards]")).toBeNull();
} finally {
diff --git a/apps/web/src/lib/wechat-copy.ts b/apps/web/src/lib/wechat-copy.ts
index b4f1eeef..f245af02 100644
--- a/apps/web/src/lib/wechat-copy.ts
+++ b/apps/web/src/lib/wechat-copy.ts
@@ -67,15 +67,11 @@ const applyLegacyWeChatStyles = (
const fontSize = `${metrics.fontSize}px`;
const lineHeight = String(metrics.lineHeight);
const codeSize = `${noteProseCodeFontSize(metrics.fontSize)}px`;
- // A named hue recolors links, inline code, and bold, matching the editor.
+ // A named hue recolors links and bold, matching the editor. Inline code stays neutral cool gray.
const link = colors?.link ?? LINK_COLOR;
- const inlineCodeColor = proseStyle.headingStyle === "numbered" ? "#1f2937" : (colors?.codeText ?? CODE_COLOR);
- const inlineCodeBackground = proseStyle.headingStyle === "numbered" ? "#f3f4f6" : (colors?.codeBackground ?? CODE_BACKGROUND);
- const inlineCodeShadow = proseStyle.headingStyle === "numbered"
- ? ""
- : colors
- ? "box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06);"
- : "box-shadow: inset 0 0 0 1px rgba(61,68,80,0.08);";
+ const inlineCodeColor = "#1f2937";
+ const inlineCodeBackground = "#f3f4f6";
+ const inlineCodeShadow = "";
const accent = colors?.accent ?? "#374151";
const surface = colors?.surface ?? "#f3f4f6";
const divider = colors?.divider ?? "#d1d5db";
@@ -137,7 +133,7 @@ const applyLegacyWeChatStyles = (
mark: "background-color: #fde68a; color: #111827; padding: 1px 4px; border-radius: 2px; font-weight: 600;",
}
: {}),
- code: `padding: 2px 6px; border: 0; border-radius: 4px; background: ${inlineCodeBackground}; ${inlineCodeShadow} color: ${inlineCodeColor}; font-family: ${PUBLISH_MONO}; font-size: ${codeSize}; font-weight: ${proseStyle.headingStyle === "numbered" ? 600 : 400};`,
+ code: `padding: 2px 6px; border: 0; border-radius: 4px; background: ${inlineCodeBackground}; color: ${inlineCodeColor}; font-family: ${PUBLISH_MONO}; font-size: ${codeSize}; font-weight: 600;`,
pre: preStyle,
hr: proseStyle.headingStyle === "numbered"
? "margin: 28px 0; border: 0; border-top: 1px solid #e5e7eb;"
diff --git a/apps/web/src/styles/editor-typography.test.mjs b/apps/web/src/styles/editor-typography.test.mjs
index 01a48eb1..0dbe8c54 100644
--- a/apps/web/src/styles/editor-typography.test.mjs
+++ b/apps/web/src/styles/editor-typography.test.mjs
@@ -84,21 +84,21 @@ describe("editor typography contract", () => {
expect(prose).not.toContain('data-note-palette="custom"');
});
- test("named palettes recolor links, bold, inline code, checked task boxes, and table surfaces", () => {
+ test("named palettes recolor links, bold, checked task boxes, and table surfaces while inline 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).toMatch(/background:\s*var\(--note-palette-code-bg\)/);
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(/\.ProseMirror code/);
expect(prose).toMatch(/\.ProseMirror pre code/);
expect(prose).toMatch(/background:\s*var\(--note-palette-accent\)/);
expect(prose).toMatch(/background:\s*#f9fafb/);
const globals = readStyle("./globals.css");
- expect(declarationsForSelector(globals, ".ProseMirror code")).toContain("color: #3d4450;");
+ expect(declarationsForSelector(globals, ".ProseMirror :not(pre) > code")).toContain("color: #1f2937;");
+ expect(declarationsForSelector(globals, ".ProseMirror :not(pre) > code")).toContain("background: #f3f4f6;");
+ expect(prose).not.toMatch(/--note-palette-code-text/);
+ expect(prose).not.toMatch(/--note-palette-code-bg/);
expect(prose).not.toMatch(/--note-palette-text/);
expect(prose).not.toMatch(/--note-palette-muted/);
expect(prose).not.toMatch(/--note-palette-divider/);
diff --git a/apps/web/src/styles/globals.css b/apps/web/src/styles/globals.css
index 1695b530..94c56666 100644
--- a/apps/web/src/styles/globals.css
+++ b/apps/web/src/styles/globals.css
@@ -1747,15 +1747,15 @@ html[data-edgeever-extension-theme] .edgeever-memo-divider {
background: #f3f5f7;
}
-.ProseMirror code {
+.ProseMirror :not(pre) > code {
border: 0;
border-radius: 4px;
- background: #e9edf1;
- box-shadow: inset 0 0 0 1px rgb(61 68 80 / 0.08);
- padding: 0.08em 0.28em;
+ background: #f3f4f6;
+ box-shadow: none;
+ padding: 2px 6px;
font-size: var(--editor-code-font-size, 0.875em);
- font-weight: 400;
- color: #3d4450;
+ font-weight: 600;
+ color: #1f2937;
font-family: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
@@ -2660,16 +2660,16 @@ html[data-edgeever-extension-theme] .edgeever-memo-divider {
line-height: 1.5;
margin: 1rem 0;
}
-.markdown-content code {
+.markdown-content :not(pre) > code {
font-family: "JetBrains Mono", "Fira Code", monospace;
- background-color: #e9edf1;
- box-shadow: inset 0 0 0 1px rgb(61 68 80 / 0.08);
- color: #3d4450;
+ background-color: #f3f4f6;
+ box-shadow: none;
+ color: #1f2937;
border: 0;
- padding: 0.08em 0.28em;
+ padding: 2px 6px;
border-radius: 4px;
font-size: 0.8rem;
- font-weight: 400;
+ font-weight: 600;
}
.markdown-content pre code {
background-color: transparent;
@@ -2925,11 +2925,11 @@ html[data-edgeever-extension-theme] .edgeever-memo-divider {
background: rgb(255 255 255 / 0.05);
}
-:root.dark .ProseMirror code,
-:root.dark .markdown-content code {
- background: rgb(255 255 255 / 0.09);
- box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.08);
- color: hsl(var(--foreground));
+:root.dark .ProseMirror :not(pre) > code,
+:root.dark .markdown-content :not(pre) > code {
+ background: rgba(255, 255, 255, 0.08);
+ box-shadow: none;
+ color: #e5e7eb;
}
:root.dark .ProseMirror pre code,
diff --git a/apps/web/src/styles/note-prose-styles.css b/apps/web/src/styles/note-prose-styles.css
index 0a7e58ab..e0ce1471 100644
--- a/apps/web/src/styles/note-prose-styles.css
+++ b/apps/web/src/styles/note-prose-styles.css
@@ -222,23 +222,6 @@
font-weight: 800;
}
-/* Inline code in numbered magazine mode: neutral cool gray so green strong text stands out */
-.edgeever-editor[data-note-heading-style="numbered"] .ProseMirror :not(pre) > code,
-.edgeever-editor[data-note-heading-style="numbered"] .markdown-content :not(pre) > code {
- background: #f3f4f6 !important;
- color: #1f2937 !important;
- box-shadow: none !important;
- font-weight: 600;
- padding: 2px 6px;
- border-radius: 4px;
-}
-
-:root.dark .edgeever-editor[data-note-heading-style="numbered"] .ProseMirror :not(pre) > code,
-:root.dark .edgeever-editor[data-note-heading-style="numbered"] .markdown-content :not(pre) > code {
- background: rgba(255, 255, 255, 0.08) !important;
- color: #e5e7eb !important;
-}
-
/* 3. Heading style: Bottom rule ("underline") */
.edgeever-editor[data-note-heading-style="underline"] .ProseMirror h2,
diff --git a/apps/web/src/styles/note-prose.css b/apps/web/src/styles/note-prose.css
index 042fc4b4..9d324d02 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, bold, inline code, checked task boxes, and table surfaces. Body, quotes, rules, and code blocks stay native. */
+/* Named hues tint links, bold, checked task boxes, and table surfaces. Body, inline code, quotes, rules, and code blocks stay native/neutral. */
: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;
@@ -19,12 +19,6 @@
color: var(--note-palette-accent);
}
-.edgeever-editor[data-note-palette]:not([data-note-palette="native"]) .ProseMirror code {
- background: var(--note-palette-code-bg);
- box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--note-palette-code-text) 14%, transparent);
- 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 {
background: transparent;
@@ -81,12 +75,6 @@
text-decoration-color: var(--note-palette-accent);
}
-:root.dark .edgeever-editor[data-note-palette]:not([data-note-palette="native"]) .ProseMirror code {
- background: color-mix(in srgb, var(--note-palette-accent) 14%, transparent);
- box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--note-palette-accent) 24%, transparent);
- 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 {
background: transparent;