Skip to content

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

fix(web): tint only links, code, and bold in note palettes

tianma-ifb8a0b88d8863
diff --git a/apps/web/src/lib/publish-layout.test.mjs b/apps/web/src/lib/publish-layout.test.mjs
index a3ef0529..2b0c2d27 100644
--- a/apps/web/src/lib/publish-layout.test.mjs
+++ b/apps/web/src/lib/publish-layout.test.mjs
@@ -218,6 +218,9 @@ describe("copy pipeline wiring", () => {
expect(source).toContain("export const preparePublishArticle");
expect(source).not.toContain("applyPublishLayout");
expect(source).toContain("applyLegacyWeChatStyles");
+ expect(source).toContain("const bold = colors ? `font-weight: 700; color: ${accent};` : \"font-weight: 700;\"");
+ expect(source).toContain("accentOnly");
+ expect(source).toContain('palette !== "custom"');
expect(preview).toContain("preparePublishArticle(editor.getHTML(), editor.view.dom)");
expect(preview).toContain("previewRef.current?.setAttribute(\"style\", markup.style)");
expect(preview).toContain("noteProse");
diff --git a/apps/web/src/lib/wechat-copy.ts b/apps/web/src/lib/wechat-copy.ts
index 935f2640..ed79733f 100644
--- a/apps/web/src/lib/wechat-copy.ts
+++ b/apps/web/src/lib/wechat-copy.ts
@@ -40,26 +40,30 @@ const applyLegacyWeChatStyles = (
root: HTMLElement,
metrics: WeChatMetrics,
colors: NoteProsePaletteColors | null,
+ accentOnly = false,
) => {
const fontSize = `${metrics.fontSize}px`;
const lineHeight = String(metrics.lineHeight);
const codeSize = `${noteProseCodeFontSize(metrics.fontSize)}px`;
- const text = colors?.text ?? "#333";
- const headingColor = colors?.text ?? "#1f2937";
- const background = colors?.background ?? "#ffffff";
+ // Named hues move link, inline-code, and bold ink. Custom still paints the whole article.
+ const painted = accentOnly ? null : colors;
+ const text = painted?.text ?? "#333";
+ const headingColor = painted?.text ?? "#1f2937";
+ const background = painted?.background ?? "#ffffff";
const accent = colors?.accent ?? "#059669";
- const quoteBorder = colors?.accent ?? "#10b981";
- const quoteBackground = colors?.surface ?? "#f0fdf4";
- const quoteColor = colors?.muted ?? "#4b5563";
+ const quoteBorder = painted?.accent ?? "#10b981";
+ const quoteBackground = painted?.surface ?? "#f0fdf4";
+ const quoteColor = painted?.muted ?? "#4b5563";
const link = colors?.link ?? "#059669";
- const inlineCodeBackground = colors?.codeBackground ?? "#f3f4f6";
- const inlineCodeColor = colors?.codeText ?? "#be123c";
- const preBackground = colors?.codeBackground ?? "#f6f8fa";
- const preColor = colors?.codeText ?? "#24292f";
- const ruleColor = colors?.divider ?? "#e5e7eb";
- const cellBorder = colors?.divider ?? "#d1d5db";
- const headBackground = colors?.surface ?? "#f3f4f6";
- const cellColor = colors ? ` color: ${text};` : "";
+ const inlineCodeBackground = painted?.codeBackground ?? "#f3f4f6";
+ const inlineCodeColor = (accentOnly ? colors?.codeText : painted?.codeText) ?? "#be123c";
+ const preBackground = painted?.codeBackground ?? "#f6f8fa";
+ const preColor = painted?.codeText ?? "#24292f";
+ const ruleColor = painted?.divider ?? "#e5e7eb";
+ const cellBorder = painted?.divider ?? "#d1d5db";
+ const headBackground = painted?.surface ?? "#f3f4f6";
+ const cellColor = painted ? ` color: ${text};` : "";
+ const bold = colors ? `font-weight: 700; color: ${accent};` : "font-weight: 700;";
const styles: Record<string, string> = {
p: `margin: 0 0 ${PARAGRAPH_SPACING}; padding: 0; line-height: ${lineHeight}; font-size: ${fontSize}; color: ${text};`,
h1: headingStyle("h1", metrics, headingColor),
@@ -73,7 +77,8 @@ const applyLegacyWeChatStyles = (
ol: `margin: 0 0 1em; padding-left: 1.6em; line-height: ${lineHeight};`,
li: `margin: 0.25em 0; line-height: ${lineHeight};`,
a: `color: ${link}; text-decoration: underline;`,
- strong: "font-weight: 700;",
+ strong: bold,
+ b: bold,
em: "font-style: italic;",
del: "text-decoration: line-through;",
code: `padding: 0.15em 0.35em; border-radius: 3px; background: ${inlineCodeBackground}; color: ${inlineCodeColor}; font-family: Menlo, Consolas, monospace; font-size: ${codeSize};`,
@@ -107,8 +112,9 @@ const applyInlineStyles = (
metrics: WeChatMetrics,
colors: NoteProsePaletteColors | null,
customCss?: string,
+ accentOnly = false,
) => {
- applyLegacyWeChatStyles(root, metrics, colors);
+ applyLegacyWeChatStyles(root, metrics, colors, accentOnly);
const customStyles = customCss ? parseCustomCssToStyles(customCss) : null;
if (!customStyles) return;
@@ -502,6 +508,7 @@ export const readEditorCopyContext = (from?: HTMLElement | null) => {
fontSize,
lineHeight,
colors,
+ accentOnly: Boolean(palette && palette !== "native" && palette !== "custom"),
customCss: customStyleTag?.dataset.originalCss || "",
};
};
@@ -518,6 +525,7 @@ export const preparePublishArticle = (
{ fontSize: context.fontSize, lineHeight: context.lineHeight },
context.colors,
context.customCss,
+ context.accentOnly,
);
flattenDetailsForLinearHtml(root);
convertImageGalleriesForWeChat(root);
diff --git a/apps/web/src/styles/editor-typography.test.mjs b/apps/web/src/styles/editor-typography.test.mjs
index 0b2e5972..aac960b4 100644
--- a/apps/web/src/styles/editor-typography.test.mjs
+++ b/apps/web/src/styles/editor-typography.test.mjs
@@ -72,6 +72,30 @@ describe("editor typography contract", () => {
expect(placeholderRules).toMatch(/color\s*:\s*#a8b5c4/);
});
+ test("paints bold text with the palette accent", () => {
+ const prose = readStyle("./note-prose.css");
+ const boldRules = declarationsForSelector(prose, ".ProseMirror strong");
+
+ expect(boldRules).toMatch(/color:\s*var\(--note-palette-accent\)/);
+ expect(boldRules).toMatch(/color:\s*var\(--note-palette-dark-accent\)/);
+ });
+
+ test("named palettes recolor links, inline code, and bold", () => {
+ const prose = readStyle("./note-prose.css");
+ const named = prose.split('.edgeever-editor[data-note-palette="custom"]')[0];
+
+ expect(named).toMatch(/color:\s*var\(--note-palette-link\)/);
+ expect(named).toMatch(/color:\s*var\(--note-palette-code-text\)/);
+ expect(named).toMatch(/color:\s*var\(--note-palette-accent\)/);
+ expect(named).toMatch(/\.edgeever-code-block code/);
+ expect(named).not.toMatch(/--note-palette-text/);
+ expect(named).not.toMatch(/--note-palette-surface/);
+ expect(named).not.toMatch(/--note-palette-muted/);
+ expect(named).not.toMatch(/--note-palette-divider/);
+ expect(named).not.toMatch(/--note-palette-code-bg/);
+ expect(named).not.toMatch(/blockquote/);
+ });
+
test("keeps bold and italic text visible across platform font fallbacks", () => {
const globals = readStyle("./globals.css");
const mobileEditor = readStyle("./mobile-markdown-editor.css");
diff --git a/apps/web/src/styles/note-prose.css b/apps/web/src/styles/note-prose.css
index e0ee8098..6a39dcd1 100644
--- a/apps/web/src/styles/note-prose.css
+++ b/apps/web/src/styles/note-prose.css
@@ -1,64 +1,45 @@
-.edgeever-editor[data-note-palette]:not([data-note-palette="native"]):not([data-note-palette="custom"]) .ProseMirror,
-.edgeever-editor[data-note-palette]:not([data-note-palette="native"]):not([data-note-palette="custom"]) .ProseMirror h1,
-.edgeever-editor[data-note-palette]:not([data-note-palette="native"]):not([data-note-palette="custom"]) .ProseMirror h2,
-.edgeever-editor[data-note-palette]:not([data-note-palette="native"]):not([data-note-palette="custom"]) .ProseMirror h3,
-.edgeever-editor[data-note-palette]:not([data-note-palette="native"]):not([data-note-palette="custom"]) .ProseMirror h4,
-.edgeever-editor[data-note-palette]:not([data-note-palette="native"]):not([data-note-palette="custom"]) .ProseMirror h5,
-.edgeever-editor[data-note-palette]:not([data-note-palette="native"]):not([data-note-palette="custom"]) .ProseMirror h6 {
- color: var(--note-palette-text);
-}
-
+/* Named hues tint links, inline code, and bold. Body, quotes, rules, tables, and code chrome stay native. */
.edgeever-editor[data-note-palette]:not([data-note-palette="native"]):not([data-note-palette="custom"]) .ProseMirror a:not(.edgeever-attachment-link) {
color: var(--note-palette-link);
+ text-decoration-color: color-mix(in srgb, var(--note-palette-link) 45%, transparent);
}
-.edgeever-editor[data-note-palette]:not([data-note-palette="native"]):not([data-note-palette="custom"]) .ProseMirror blockquote {
- background: var(--note-palette-surface);
- color: var(--note-palette-muted);
+.edgeever-editor[data-note-palette]:not([data-note-palette="native"]):not([data-note-palette="custom"]) .ProseMirror a:not(.edgeever-attachment-link):hover {
+ color: var(--note-palette-link);
+ text-decoration-color: var(--note-palette-link);
}
-.edgeever-editor[data-note-palette]:not([data-note-palette="native"]):not([data-note-palette="custom"]) .ProseMirror hr,
-.edgeever-editor[data-note-palette]:not([data-note-palette="native"]):not([data-note-palette="custom"]) .ProseMirror td,
-.edgeever-editor[data-note-palette]:not([data-note-palette="native"]):not([data-note-palette="custom"]) .ProseMirror th {
- border-color: var(--note-palette-divider);
+.edgeever-editor[data-note-palette]:not([data-note-palette="native"]):not([data-note-palette="custom"]) .ProseMirror strong,
+.edgeever-editor[data-note-palette]:not([data-note-palette="native"]):not([data-note-palette="custom"]) .ProseMirror b {
+ color: var(--note-palette-accent);
}
.edgeever-editor[data-note-palette]:not([data-note-palette="native"]):not([data-note-palette="custom"]) .ProseMirror code {
- background: var(--note-palette-code-bg);
color: var(--note-palette-code-text);
- border-color: var(--note-palette-divider);
}
-:root.dark .edgeever-editor[data-note-palette]:not([data-note-palette="native"]):not([data-note-palette="custom"]) .ProseMirror,
-:root.dark .edgeever-editor[data-note-palette]:not([data-note-palette="native"]):not([data-note-palette="custom"]) .ProseMirror h1,
-:root.dark .edgeever-editor[data-note-palette]:not([data-note-palette="native"]):not([data-note-palette="custom"]) .ProseMirror h2,
-:root.dark .edgeever-editor[data-note-palette]:not([data-note-palette="native"]):not([data-note-palette="custom"]) .ProseMirror h3,
-:root.dark .edgeever-editor[data-note-palette]:not([data-note-palette="native"]):not([data-note-palette="custom"]) .ProseMirror h4,
-:root.dark .edgeever-editor[data-note-palette]:not([data-note-palette="native"]):not([data-note-palette="custom"]) .ProseMirror h5,
-:root.dark .edgeever-editor[data-note-palette]:not([data-note-palette="native"]):not([data-note-palette="custom"]) .ProseMirror h6 {
- color: hsl(var(--foreground));
- background: transparent;
+.edgeever-editor[data-note-palette]:not([data-note-palette="native"]):not([data-note-palette="custom"]) .ProseMirror pre code,
+.edgeever-editor[data-note-palette]:not([data-note-palette="native"]):not([data-note-palette="custom"]) .ProseMirror .edgeever-code-block code {
+ color: inherit;
}
-:root.dark .edgeever-editor[data-note-palette]:not([data-note-palette="native"]):not([data-note-palette="custom"]) .ProseMirror blockquote {
- color: hsl(var(--foreground));
- background: rgb(255 255 255 / 0.05);
+:root.dark .edgeever-editor[data-note-palette]:not([data-note-palette="native"]):not([data-note-palette="custom"]) .ProseMirror a:not(.edgeever-attachment-link) {
+ color: var(--note-palette-accent);
+ text-decoration-color: color-mix(in srgb, var(--note-palette-accent) 45%, transparent);
}
-:root.dark .edgeever-editor[data-note-palette]:not([data-note-palette="native"]):not([data-note-palette="custom"]) .ProseMirror a:not(.edgeever-attachment-link),
-:root.dark .edgeever-editor[data-note-palette]:not([data-note-palette="native"]):not([data-note-palette="custom"]) .ProseMirror code {
+:root.dark .edgeever-editor[data-note-palette]:not([data-note-palette="native"]):not([data-note-palette="custom"]) .ProseMirror a:not(.edgeever-attachment-link):hover {
color: var(--note-palette-accent);
+ text-decoration-color: var(--note-palette-accent);
}
:root.dark .edgeever-editor[data-note-palette]:not([data-note-palette="native"]):not([data-note-palette="custom"]) .ProseMirror code {
- border-color: rgb(255 255 255 / 0.12);
- background: rgb(255 255 255 / 0.06);
+ color: var(--note-palette-accent);
}
-:root.dark .edgeever-editor[data-note-palette]:not([data-note-palette="native"]):not([data-note-palette="custom"]) .ProseMirror hr,
-:root.dark .edgeever-editor[data-note-palette]:not([data-note-palette="native"]):not([data-note-palette="custom"]) .ProseMirror td,
-:root.dark .edgeever-editor[data-note-palette]:not([data-note-palette="native"]):not([data-note-palette="custom"]) .ProseMirror th {
- border-color: rgb(var(--slate-200-rgb) / 0.7);
+:root.dark .edgeever-editor[data-note-palette]:not([data-note-palette="native"]):not([data-note-palette="custom"]) .ProseMirror pre code,
+:root.dark .edgeever-editor[data-note-palette]:not([data-note-palette="native"]):not([data-note-palette="custom"]) .ProseMirror .edgeever-code-block code {
+ color: inherit;
}
.edgeever-editor[data-note-palette="custom"] .ProseMirror {
@@ -79,6 +60,11 @@
color: var(--note-palette-link);
}
+.edgeever-editor[data-note-palette="custom"] .ProseMirror strong,
+.edgeever-editor[data-note-palette="custom"] .ProseMirror b {
+ color: var(--note-palette-accent);
+}
+
.edgeever-editor[data-note-palette="custom"] .ProseMirror blockquote {
background: var(--note-palette-surface);
color: var(--note-palette-muted);
@@ -114,6 +100,11 @@
color: var(--note-palette-dark-link);
}
+:root.dark .edgeever-editor[data-note-palette="custom"] .ProseMirror strong,
+:root.dark .edgeever-editor[data-note-palette="custom"] .ProseMirror b {
+ color: var(--note-palette-dark-accent);
+}
+
:root.dark .edgeever-editor[data-note-palette="custom"] .ProseMirror blockquote {
background: var(--note-palette-dark-surface);
color: var(--note-palette-dark-muted);
diff --git a/docs/editor-typography-plan.zh-CN.md b/docs/editor-typography-plan.zh-CN.md
index a3a1c123..a5bd41d7 100644
--- a/docs/editor-typography-plan.zh-CN.md
+++ b/docs/editor-typography-plan.zh-CN.md
@@ -23,7 +23,7 @@
| 笔记正文字体 | 保持现有列表:跟随系统、霞鹜文楷、霞鹜文楷屏幕版、朱雀仿宋、思源宋体、霞鹜新致宋、思源黑体、西文衬线、自定义 | 跟随系统 |
| 正文字号 | 14、16、18、20 | 16 |
| 行高 | 紧凑 1.5、标准 1.65、宽松 2.0 | 标准 |
-| 正文配色 | 原生,加上下面 10 款;另有自定义 | 原生 |
+| 正文配色 | 原生,加上下面 9 款;另有自定义 | 原生 |
字号、行高、栏宽用固定档位,不用滑杆。正文字号和行高的说明各一行:**同时用于编辑器和公开分享。** 正文宽度的说明一行:**只改变这台设备上的编辑区。**
@@ -61,16 +61,15 @@
笔记正文字体维持现状:本机选择,内置字体仍可发布到公开分享页,自定义字体名称不发布。
-正文配色放在「阅读」里,用固定选项,不用滑杆。默认是现在的原生配色。另外 10 款按色相分开,每款差一个大色相。浅色沿用现成色板的正文色、弱化色、表面色、分隔线和代码色。深色模式保持现在的深色背景和正文色,强调色跟所选配色走。界面、侧栏、工具栏、图表和信息图不跟着变。
+正文配色放在「阅读」里,用固定选项,不用滑杆。默认是现在的原生配色。另外 9 款按色相分开,每款差一个大色相。浅色沿用现成色板的正文色、弱化色、表面色、分隔线和代码色。深色模式保持现在的深色背景和正文色,强调色跟所选配色走。界面、侧栏、工具栏、图表和信息图不跟着变。
-原先那 10 款里,琥珀和日暖都是金黄,夜蓝和青页都是蓝,雾色和青玉都是青,林绿又接近品牌绿。这四款舍弃。空出来的位置用已经画好的绿色和酒红,再补色相上没有的橙色和粉色。设置里的名字直接用色名。
+原先那 10 款里,琥珀和日暖都是金黄,夜蓝和青页都是蓝,雾色和青玉都是青,林绿又接近品牌绿。这四款舍弃。空出来的位置用酒红,再补色相上没有的橙色和粉色。绿色曾放进选项,后来去掉。设置里的名字直接用色名。
| 名称 | 色板 | 强调色 |
|---|---|---|
| 红色 | clay | `#E02D32` |
| 橙色 | 新 | `#E07A2D` |
| 金色 | dawn | `#D9A521` |
-| 绿色 | emerald | `#16A06E` |
| 青色 | teal | `#22B8A7` |
| 蓝色 | azure | `#2F80ED` |
| 紫色 | violet | `#7567F8` |
@@ -95,7 +94,7 @@
|---|---|
| 陶色时评 | 红色 |
| 琥珀田记、日暖素笺 | 金色 |
-| 林间手记、极简青翠、线描翠绿、微信新绿、薄荷清新 | 绿色 |
+| 林间手记、极简青翠、线描翠绿、微信新绿、薄荷清新 | 原生 |
| 青玉编按、雾色静页 | 青色 |
| 青页讲义、夜蓝制图 | 蓝色 |
| 堇色目录 | 紫色 |
diff --git a/migrations/0058_retire_emerald_note_palette.sql b/migrations/0058_retire_emerald_note_palette.sql
new file mode 100644
index 00000000..293ae15c
--- /dev/null
+++ b/migrations/0058_retire_emerald_note_palette.sql
@@ -0,0 +1,3 @@
+UPDATE users
+SET note_prose_palette = 'native'
+WHERE note_prose_palette = 'emerald';
diff --git a/packages/shared/src/i18n/en-US.ts b/packages/shared/src/i18n/en-US.ts
index bb1ecffb..f1c02d82 100644
--- a/packages/shared/src/i18n/en-US.ts
+++ b/packages/shared/src/i18n/en-US.ts
@@ -788,7 +788,6 @@ export const enUS = {
clay: "Red",
orange: "Orange",
dawn: "Gold",
- emerald: "Green",
teal: "Teal",
azure: "Blue",
violet: "Purple",
diff --git a/packages/shared/src/i18n/ja.ts b/packages/shared/src/i18n/ja.ts
index c9267dc0..af2630d7 100644
--- a/packages/shared/src/i18n/ja.ts
+++ b/packages/shared/src/i18n/ja.ts
@@ -788,7 +788,6 @@ export const ja = {
clay: "赤",
orange: "オレンジ",
dawn: "金",
- emerald: "緑",
teal: "青緑",
azure: "青",
violet: "紫",
diff --git a/packages/shared/src/i18n/zh-CN.ts b/packages/shared/src/i18n/zh-CN.ts
index edbb8ac1..7113b58b 100644
--- a/packages/shared/src/i18n/zh-CN.ts
+++ b/packages/shared/src/i18n/zh-CN.ts
@@ -788,7 +788,6 @@ export const zhCN = {
clay: "红色",
orange: "橙色",
dawn: "金色",
- emerald: "绿色",
teal: "青色",
azure: "蓝色",
violet: "紫色",
diff --git a/packages/shared/src/note-prose.test.mjs b/packages/shared/src/note-prose.test.mjs
index dd5ae9b3..43cc8d76 100644
--- a/packages/shared/src/note-prose.test.mjs
+++ b/packages/shared/src/note-prose.test.mjs
@@ -6,6 +6,8 @@ import {
noteProseCodeFontSize,
noteProseMigrationPatch,
paletteForLegacyEditorTheme,
+ parseNoteProsePalette,
+ resolveNoteProse,
sanitizeNoteProseCss,
} from "@edgeever/shared";
@@ -22,9 +24,13 @@ describe("note prose", () => {
expect(paletteForLegacyEditorTheme("stance")).toBe("clay");
expect(paletteForLegacyEditorTheme("stub")).toBe("dawn");
expect(paletteForLegacyEditorTheme("letter")).toBe("dawn");
- expect(paletteForLegacyEditorTheme("grove")).toBe("emerald");
- expect(paletteForLegacyEditorTheme("minimal-emerald")).toBe("emerald");
- expect(paletteForLegacyEditorTheme("wechat-green")).toBe("emerald");
+ expect(paletteForLegacyEditorTheme("grove")).toBeNull();
+ expect(paletteForLegacyEditorTheme("minimal-emerald")).toBeNull();
+ expect(paletteForLegacyEditorTheme("outline-emerald")).toBeNull();
+ expect(paletteForLegacyEditorTheme("wechat-green")).toBeNull();
+ expect(paletteForLegacyEditorTheme("modern-mint")).toBeNull();
+ expect(parseNoteProsePalette("emerald")).toBe("native");
+ expect(resolveNoteProse({ palette: "emerald" }).palette).toBe("native");
expect(paletteForLegacyEditorTheme("brief")).toBe("teal");
expect(paletteForLegacyEditorTheme("zen")).toBe("teal");
expect(paletteForLegacyEditorTheme("guide")).toBe("azure");
@@ -56,11 +62,11 @@ describe("note prose", () => {
test("fills only account fields that were never set", () => {
expect(noteProseMigrationPatch(emptyAccount(), {
- palette: "emerald",
+ palette: "teal",
customCss: "p { color: red; }",
customColors: null,
})).toEqual({
- palette: "emerald",
+ palette: "teal",
customCss: "p { color: red; }",
});
diff --git a/packages/shared/src/note-prose.ts b/packages/shared/src/note-prose.ts
index 3b1951c3..d618d3f8 100644
--- a/packages/shared/src/note-prose.ts
+++ b/packages/shared/src/note-prose.ts
@@ -10,7 +10,6 @@ export const NOTE_PROSE_PALETTE_IDS = [
"clay",
"orange",
"dawn",
- "emerald",
"teal",
"azure",
"violet",
@@ -144,22 +143,11 @@ export const NOTE_PROSE_PALETTES: Record<NoteProsePaletteId, NoteProsePaletteCol
codeText: "#7C5500",
background: "#FFFFFF",
}),
- emerald: palette({
- accent: "#16A06E",
- text: "#2C3A34",
- muted: "#5C6F66",
- surface: "#F4FBF7",
- divider: "#D7EBE1",
- link: "#0F7A54",
- codeBackground: "#F3F7F5",
- codeText: "#0F7A54",
- background: "#FFFFFF",
- }),
teal: palette({
accent: "#22B8A7",
- text: "#4D4F46",
- muted: "#4D4F46",
- surface: "#EEEFE9",
+ text: "#3E4C4A",
+ muted: "#5C6E6B",
+ surface: "#F2FBFA",
divider: "#CDEFEA",
link: "#1A8F82",
codeBackground: "#ECFBF8",
@@ -224,11 +212,6 @@ export const NOTE_PROSE_PALETTES: Record<NoteProsePaletteId, NoteProsePaletteCol
};
const LEGACY_EDITOR_THEME_PALETTES: Record<string, NoteProsePaletteChoice> = {
- "minimal-emerald": "emerald",
- "outline-emerald": "emerald",
- "wechat-green": "emerald",
- "modern-mint": "emerald",
- grove: "emerald",
letter: "dawn",
stub: "dawn",
brief: "teal",
@@ -278,10 +261,13 @@ export const parseNoteProseLineHeight = (value: unknown): NoteProseLineHeight |
return null;
};
-export const parseNoteProsePalette = (value: unknown): NoteProsePaletteChoice | null =>
- typeof value === "string" && (NOTE_PROSE_PALETTE_CHOICES as readonly string[]).includes(value)
+export const parseNoteProsePalette = (value: unknown): NoteProsePaletteChoice | null => {
+ // The green option was removed. Stored rows keep reading as the native palette.
+ if (value === "emerald") return "native";
+ return typeof value === "string" && (NOTE_PROSE_PALETTE_CHOICES as readonly string[]).includes(value)
? value as NoteProsePaletteChoice
: null;
+};
const isColorSet = (value: unknown): value is NoteProseCustomColorSet => {
if (typeof value !== "object" || value === null) return false;
@@ -323,7 +309,7 @@ export const noteProseCodeFontSize = (fontSize: number): number => {
export const resolveNoteProse = (account: Partial<AccountNoteProse> | null | undefined): ResolvedNoteProse => ({
fontSize: account?.fontSize ?? DEFAULT_NOTE_PROSE_FONT_SIZE,
lineHeight: account?.lineHeight ?? DEFAULT_NOTE_PROSE_LINE_HEIGHT,
- palette: account?.palette ?? "native",
+ palette: parseNoteProsePalette(account?.palette) ?? "native",
customCss: account?.customCss ?? "",
customColors: account?.palette === "custom"
? account.customColors ?? DEFAULT_NOTE_PROSE_CUSTOM_COLORS