From 81f9ea00729341161406497d1f61788f11974505 Mon Sep 17 00:00:00 2001 From: cflmy Date: Sun, 18 Oct 2026 03:05:29 +0800 Subject: [PATCH] fix(view): map document tokens to the active theme Legacy view tokens (--ink, --fill, --line, --muted) now resolve from the notebook theme. This fixes dark text and white annotation chips on the dark STRUCTURE surface, including function names, binding labels, tables, and the right rail. --- CHANGELOG.md | 1 + src/view/html.rs | 23 ++++++++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a31bedb..b240908 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ ### Fixed +- **view 文档表面与标注 chip**:把旧 view 的 `--ink` / `--fill` / `--line` 等 token 映射到当前主题,修复 STRUCTURE 中 `main`、`内核表 =`、函数名和 annot-chip 深色文字/白色卡片与暗色背景不一致的问题。 - **view 代码对比度**:移除会互相覆盖的 highlight.js 深/浅两套外链样式,改用内置高对比 token 变量;深色代码正文 `#f0f0f0` on `#1e1e1e`(14.6:1),浅色 `#24292f` on `#f6f8fa`(13.8:1);关键词/字符串/注释均使用可读的对比色。 - **view 反向代理兼容**:Notebook / Debug 的 API 与 Debug URL 改为相对路径,可在 `/marqdo-view/...` 路径前缀下工作,便于 Docker 内通过 DSH 同源预览。 - **分支内共同局部变量**:if/else 各臂都赋值的局部变量不再被误提升为必选形参;修复 `# llm` 构造器无端要求 `key`,恢复 agent/llm/ext 全量测试。新增 `branch_else_common_local_is_not_a_param` 回归测试。 diff --git a/src/view/html.rs b/src/view/html.rs index df773c0..e87c0b7 100644 --- a/src/view/html.rs +++ b/src/view/html.rs @@ -2881,7 +2881,7 @@ body.notebook-page { --nb-surface-3: #333333; --nb-border: #3c3c3c; --nb-border-soft: #2a2a2a; - --nb-text: #d4d4d4; + --nb-text: #f0f0f0; --nb-strong: #f0f0f0; --nb-muted: #9d9d9d; --nb-accent: #0e639c; @@ -2897,6 +2897,20 @@ body.notebook-page { --nb-error-bg: #2a0f12; --nb-error-border: #5a1d1d; --nb-radius: 6px; + /* Map every legacy view token onto the active theme. This fixes the + document surface and annotation chips without duplicating rules. */ + --bg: var(--nb-bg); + --surface: var(--nb-surface); + --ink: var(--nb-text); + --muted: var(--nb-muted); + --line: var(--nb-border); + --line-strong: var(--nb-strong); + --fill: var(--nb-surface-2); + --hover: var(--nb-surface-3); + --focus: var(--nb-accent); + --fail-bg: var(--nb-error-bg); + --ok-bg: var(--nb-surface); + --radius: var(--nb-radius); background: var(--nb-bg); color: var(--nb-text); } @@ -3192,6 +3206,13 @@ body.notebook-page .doc-table th { body.notebook-page .doc-table td { color: var(--nb-text); } /* ── Code cell ─────────────────────────────────────────────────────── */ +body.notebook-page .annot-chip:hover, +body.notebook-page .annot-chip.is-focus { + background: var(--nb-surface-3); +} +body.notebook-page .mq-anchor.is-focus { + background: rgba(255,255,255,.08); +} body.notebook-page .code-card { display: flex; flex-direction: column;