Skip to content

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

refactor(web): refine dark surfaces and Mermaid palette

tianma-iff0221fba961b
diff --git a/apps/web/src/components/ThemeProvider.tsx b/apps/web/src/components/ThemeProvider.tsx
index e24555bf..b8524fe5 100644
--- a/apps/web/src/components/ThemeProvider.tsx
+++ b/apps/web/src/components/ThemeProvider.tsx
@@ -1,5 +1,5 @@
import { createContext, useCallback, useContext, useEffect, useMemo, useState, type ReactNode } from "react";
-import { DIAGRAM_CANVAS_DARK, DIAGRAM_CANVAS_LIGHT } from "@edgeever/shared";
+import { DIAGRAM_CANVAS_LIGHT } from "@edgeever/shared";
import {
DEFAULT_CUSTOM_DARK_COLORS,
DEFAULT_CUSTOM_EDITOR_THEME,
@@ -61,13 +61,13 @@ export const MERMAID_THEME_PALETTES: Record<MermaidThemeName, MermaidThemePalett
border: "#d4d4d8",
},
"zinc-dark": {
- bg: DIAGRAM_CANVAS_DARK,
- fg: "#FAFAFA",
- line: "#8b938c",
- accent: "#d4d4d8",
- muted: "#d4d4d8",
- surface: "#242b27",
- border: "#3d4741",
+ bg: "#222325",
+ fg: "#e4e5e7",
+ line: "#85898f",
+ accent: "#c4c7cb",
+ muted: "#b9bdc1",
+ surface: "#2d2f32",
+ border: "#46494e",
},
"tokyo-night": { bg: "#1a1b26", fg: "#a9b1d6", line: "#3d59a1", accent: "#7aa2f7", muted: "#7c85ac" },
"tokyo-night-storm": { bg: "#24283b", fg: "#a9b1d6", line: "#3d59a1", accent: "#7aa2f7", muted: "#8991b8" },
@@ -175,7 +175,7 @@ const EDITOR_THEME_STORAGE_KEY = "edgeever.editor-theme";
const CUSTOM_EDITOR_THEME_STORAGE_KEY = "edgeever.custom-editor-theme";
const CUSTOM_EDITOR_THEMES_STORAGE_KEY = "edgeever.custom-editor-themes";
const LIGHT_THEME_COLOR = "#eef1f4";
-const DARK_THEME_COLOR = "#101010";
+const DARK_THEME_COLOR = "#121315";
const AppearanceThemeContext = createContext<AppearanceThemeContextValue | null>(null);
const MermaidThemeContext = createContext<MermaidThemeContextValue | null>(null);
const MarkdownThemeContext = createContext<MarkdownThemeContextValue | null>(null);
diff --git a/apps/web/src/components/settings/NoteProseCssPreview.tsx b/apps/web/src/components/settings/NoteProseCssPreview.tsx
index a7b1147a..188863d7 100644
--- a/apps/web/src/components/settings/NoteProseCssPreview.tsx
+++ b/apps/web/src/components/settings/NoteProseCssPreview.tsx
@@ -10,7 +10,7 @@ const previewBaseCss = `
color: #27272a;
}
.${NOTE_PROSE_CSS_PREVIEW_DARK_CLASS} .edgeever-editor {
- background: #1c1c1c;
+ background: #222325;
color: #dedede;
}
.ProseMirror {
diff --git a/apps/web/src/lib/dark-theme.test.mjs b/apps/web/src/lib/dark-theme.test.mjs
index d84d269e..ed9fd0c0 100644
--- a/apps/web/src/lib/dark-theme.test.mjs
+++ b/apps/web/src/lib/dark-theme.test.mjs
@@ -42,7 +42,7 @@ describe("dark theme contracts", () => {
const memoCard = readFileSync(new URL("../components/MemoCard.tsx", import.meta.url), "utf8");
expect(css).toContain(":root.dark .edgeever-public-share .ProseMirror");
expect(css).toContain("color: hsl(var(--foreground));");
- expect(css).toContain("--workspace-memo-divider: #404040;");
+ expect(css).toContain("--workspace-memo-divider: #383a3d;");
expect(css).toContain(":root.dark .edgeever-workspace-memo-list .edgeever-memo-divider");
expect(memoCard).toContain("edgeever-memo-divider");
expect(memoCard).not.toContain("dark:lg:border-slate-300");
@@ -67,21 +67,23 @@ describe("dark theme contracts", () => {
test("workspace dark surfaces stay neutral and bundled editor themes blend into the canvas", () => {
const css = readFileSync(new URL("../styles/globals.css", import.meta.url), "utf8");
- expect(css).toContain("--workspace-canvas: #101010;");
- expect(css).toContain("--workspace-sidebar: #141414;");
- expect(css).toContain("--workspace-memo-list: #181818;");
- expect(css).toContain("--workspace-editor: #1c1c1c;");
+ expect(css).toContain("--workspace-canvas: #121315;");
+ expect(css).toContain("--workspace-sidebar: #17181a;");
+ expect(css).toContain("--workspace-memo-list: #1d1e20;");
+ expect(css).toContain("--workspace-editor: #222325;");
+ expect(css).toContain("--workspace-selection: #333638;");
+ expect(css).toContain("--workspace-hover: color-mix(in srgb, var(--workspace-sidebar) 90%, white);");
expect(css).toContain("--slate-500-rgb: 161 161 161;");
expect(css).toContain(':not([data-editor-theme="custom"])');
expect(css).toContain("--editor-theme-bg: var(--workspace-editor);");
- expect(contrastRatio("#dedede", "#1c1c1c")).toBeGreaterThanOrEqual(4.5);
- expect(contrastRatio("#a3a3a3", "#1c1c1c")).toBeGreaterThanOrEqual(4.5);
+ expect(contrastRatio("#dedede", "#222325")).toBeGreaterThanOrEqual(4.5);
+ expect(contrastRatio("#a3a3a3", "#222325")).toBeGreaterThanOrEqual(4.5);
});
test("dark chrome uses workspace tokens instead of leftover blue-slate", () => {
const css = readFileSync(new URL("../styles/globals.css", import.meta.url), "utf8");
- expect(css).toContain("--tooltip-bg: #2c2c2c;");
+ expect(css).toContain("--tooltip-bg: #303234;");
expect(css).toContain("--scrollbar-thumb: rgb(145 145 145 / 0.38);");
expect(css).toContain("--search-match: rgb(22 160 110 / 0.32);");
expect(css).toContain(":root.dark .ProseMirror .edgeever-mermaid-preview");
@@ -98,9 +100,9 @@ describe("dark theme contracts", () => {
const { tokens } = readDarkThemeTokens(theme);
expect(tokens.bg).toBe("var(--workspace-editor)");
- expect(contrastRatio(tokens.text, "#1c1c1c")).toBeGreaterThanOrEqual(4.5);
- expect(contrastRatio(tokens.heading, "#1c1c1c")).toBeGreaterThanOrEqual(4.5);
- expect(contrastRatio(tokens.accent, "#1c1c1c")).toBeGreaterThanOrEqual(3);
+ expect(contrastRatio(tokens.text, "#222325")).toBeGreaterThanOrEqual(4.5);
+ expect(contrastRatio(tokens.heading, "#222325")).toBeGreaterThanOrEqual(4.5);
+ expect(contrastRatio(tokens.accent, "#222325")).toBeGreaterThanOrEqual(3);
expect(contrastRatio(tokens.muted, tokens.soft)).toBeGreaterThanOrEqual(4.5);
expect(contrastRatio(tokens["code-text"], tokens["code-bg"])).toBeGreaterThanOrEqual(4.5);
}
diff --git a/apps/web/src/lib/mermaid-theme.test.mjs b/apps/web/src/lib/mermaid-theme.test.mjs
index 9344e0c2..737cbf2b 100644
--- a/apps/web/src/lib/mermaid-theme.test.mjs
+++ b/apps/web/src/lib/mermaid-theme.test.mjs
@@ -1,4 +1,5 @@
import { describe, expect, test } from "bun:test";
+import { readFileSync } from "node:fs";
import { renderMermaidSVG, THEMES } from "beautiful-mermaid";
import { MERMAID_THEME_PALETTES } from "../components/ThemeProvider";
import { contrastRatio } from "./color-contrast";
@@ -45,9 +46,13 @@ describe("official Mermaid theme variables", () => {
expect(lightVariables.primaryBorderColor).toBe(light.border);
expect(lightVariables.lineColor).toBe(light.line);
expect(lightVariables.fontSize).toBe("12px");
- expect(dark.bg).toBe("#191e1b");
- expect(dark.surface).toBe("#242b27");
- expect(dark.muted).toBe("#d4d4d8");
+ const globals = readFileSync(new URL("../styles/globals.css", import.meta.url), "utf8");
+ expect(globals).toContain(`--workspace-editor: ${dark.bg};`);
+ expect(dark.bg).toBe("#222325");
+ expect(dark.line).toBe("#85898f");
+ expect(dark.surface).toBe("#2d2f32");
+ expect(dark.border).toBe("#46494e");
+ expect(dark.muted).toBe("#b9bdc1");
});
test("keeps primary and secondary diagram text readable in every theme", () => {
diff --git a/apps/web/src/lib/ui-palette.test.mjs b/apps/web/src/lib/ui-palette.test.mjs
index 57d3c653..5747b08c 100644
--- a/apps/web/src/lib/ui-palette.test.mjs
+++ b/apps/web/src/lib/ui-palette.test.mjs
@@ -35,7 +35,7 @@ describe("application color system", () => {
expect(settings).not.toContain("text-emerald-");
expect(contrastRatio("#ffffff", "#525252")).toBeGreaterThanOrEqual(4.5);
expect(contrastRatio("#ffffff", "#1a1d21")).toBeGreaterThanOrEqual(4.5);
- expect(contrastRatio("#101010", "#e8e8e8")).toBeGreaterThanOrEqual(4.5);
+ expect(contrastRatio("#121315", "#e8e8e8")).toBeGreaterThanOrEqual(4.5);
});
test("keeps the light workspace on a cool gray palette while preserving text hierarchy", () => {
@@ -63,16 +63,16 @@ describe("application color system", () => {
});
test("keeps dark workspace surfaces distinct and neutral", () => {
- expect(globals).toContain("--workspace-canvas: #101010;");
- expect(globals).toContain("--workspace-sidebar: #141414;");
- expect(globals).toContain("--workspace-memo-list: #181818;");
- expect(globals).toContain("--workspace-editor: #1c1c1c;");
+ expect(globals).toContain("--workspace-canvas: #121315;");
+ expect(globals).toContain("--workspace-sidebar: #17181a;");
+ expect(globals).toContain("--workspace-memo-list: #1d1e20;");
+ expect(globals).toContain("--workspace-editor: #222325;");
expect(globals).toContain("--foreground: 0 0% 87%;");
expect(globals).toContain("--border: 0 0% 23%;");
expect(globals).toContain("--amber-300-rgb: 180 83 9;");
expect(globals).not.toContain("scrollbar-color: rgba(100, 116, 139, 0.18)");
- expect(contrastRatio("#dedede", "#1c1c1c")).toBeGreaterThanOrEqual(4.5);
- expect(contrastRatio("#a3a3a3", "#1c1c1c")).toBeGreaterThanOrEqual(4.5);
- expect(contrastRatio("#a0a0a0", "#1c1c1c")).toBeGreaterThanOrEqual(4.5);
+ expect(contrastRatio("#dedede", "#222325")).toBeGreaterThanOrEqual(4.5);
+ expect(contrastRatio("#a3a3a3", "#222325")).toBeGreaterThanOrEqual(4.5);
+ expect(contrastRatio("#a0a0a0", "#222325")).toBeGreaterThanOrEqual(4.5);
});
});
diff --git a/apps/web/src/styles/globals.css b/apps/web/src/styles/globals.css
index a351a374..652a9665 100644
--- a/apps/web/src/styles/globals.css
+++ b/apps/web/src/styles/globals.css
@@ -388,18 +388,18 @@
--border: 0 0% 23%;
--input: 0 0% 23%;
--ring: 0 0% 75%;
- --workspace-canvas: #101010;
- --workspace-sidebar: #141414;
- --workspace-memo-list: #181818;
- --workspace-editor: #1c1c1c;
- --workspace-divider: #303030;
- --workspace-memo-divider: #404040;
- --workspace-selection: #303030;
- --workspace-hover: color-mix(in srgb, var(--workspace-sidebar) 82%, white);
- --memo-content-divider-color: #e8e8e8;
- --tooltip-bg: #2c2c2c;
+ --workspace-canvas: #121315;
+ --workspace-sidebar: #17181a;
+ --workspace-memo-list: #1d1e20;
+ --workspace-editor: #222325;
+ --workspace-divider: #323437;
+ --workspace-memo-divider: #383a3d;
+ --workspace-selection: #333638;
+ --workspace-hover: color-mix(in srgb, var(--workspace-sidebar) 90%, white);
+ --memo-content-divider-color: #62666b;
+ --tooltip-bg: #303234;
--tooltip-fg: #dedede;
- --tooltip-border: #454545;
+ --tooltip-border: #45474a;
--tooltip-shadow: 0 1px 2px rgb(0 0 0 / 0.28), 0 8px 20px rgb(0 0 0 / 0.32);
--scrollbar-thumb: rgb(145 145 145 / 0.38);
--scrollbar-thumb-hover: rgb(145 145 145 / 0.55);
@@ -407,9 +407,9 @@
--search-match-active: rgb(36 185 134 / 0.48);
--switch-thumb: #f0f0f0;
--switch-track-on: #e8e8e8;
- --switch-thumb-on: #101010;
+ --switch-thumb-on: #121315;
--checkbox-on: #e8e8e8;
- --checkbox-mark: #101010;
+ --checkbox-mark: #121315;
--slate-50-rgb: 17 17 17;
--slate-100-rgb: 25 25 25;
--slate-200-rgb: 43 43 43;
@@ -439,7 +439,7 @@
--rose-800-rgb: 254 205 211;
--rose-950-rgb: 255 241 242;
--blue-600-rgb: 147 197 253;
- --dark-surface-rgb: 28 28 28;
+ --dark-surface-rgb: 34 35 37;
--brand-green: #16a06e;
--brand-green-hover: #24b986;
--brand-green-muted: #183a31;
@@ -2590,8 +2590,8 @@ html[data-edgeever-extension-theme] .edgeever-memo-divider {
:root.dark .ProseMirror th,
:root.dark .markdown-content th {
- background: rgb(var(--slate-100-rgb) / 0.9);
- color: #f1f5f9;
+ background: rgb(255 255 255 / 0.035);
+ color: hsl(var(--foreground));
}
:root.dark .ProseMirror .tableWrapper,
@@ -2610,12 +2610,12 @@ html[data-edgeever-extension-theme] .edgeever-memo-divider {
:root.dark .ProseMirror tbody tr:nth-child(even) td,
:root.dark .markdown-content tbody tr:nth-child(even) td {
- background: rgb(var(--slate-50-rgb) / 0.6);
+ background: rgb(255 255 255 / 0.02);
}
:root.dark .ProseMirror tbody tr:hover td,
:root.dark .markdown-content tbody tr:hover td {
- background: rgb(var(--slate-100-rgb) / 0.8);
+ background: rgb(255 255 255 / 0.055);
}
:root.dark .edgeever-paper,