fix(tokens): 端口描边改由文字色派生(深色下与填充同色,边缘糊)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 37s

换完 --iwb-field 底色后放大 8 倍发现:深色下端口是一团糊的圆点,不是清晰的旋钮。
原因不是颜色不够亮,是描边用的 --iwb-border2 在深色下是 #4d4d4d,与填充 #494949 同色 ——
1.5px 描边等于不存在,12px 的小圆点只能靠 12 级填充差自我定义。

改为 color-mix(text 55%, transparent):亮 #828282 / 暗 #9e9e9e,
对填充各 4.6:1 / 3.4:1(非文字元素红线 3:1),两个主题同一档锐度。

node-scope-test 补一条断言:端口描边必须由 --iwb-text 派生,不许退回 --iwb-border2。
这条守的是「边缘锐度」而不是「颜色对不对」—— 后者截图能看出来,前者只有放大才看得见。
This commit is contained in:
qiqi committed 2026-11-23 16:31:40 +08:00
1 parent 513c300e43
commit f4a5709e8b
7 files changed
+14 -1

No files matched your search

+4
View File
@@ -30,6 +30,10 @@ M4-B5 批次。用户能感知的是**深色画布上节点的连接端口看得
同一个病灶在节点内还有 6 处,一并改成 `field`:引用图占位(`.iwb-ref-img` / `.iwb-ref-single`)、
引用链接按钮、迷你引用空位、任务结果图、节点标题带 hover。
**端口描边单独处理**:换完底色后放大 8 倍才发现深色下端口「糊成一团」—— 描边用的是 `--iwb-border2`(`#4d4d4d`),
和新的填充 `#494949` 几乎同色,等于没有描边。改成由文字色派生的 `color-mix(text 55%, transparent)`:
亮 `#828282` / 暗 `#9e9e9e`,对填充各 4.6:1 / 3.4:1(非文字元素红线 3:1),两个主题同一档锐度。
**浮条按钮 hover 在深色下完全没有反馈**
浮条底是 `--iwb-panel`(`#1c1c1c`),子项 hover 用 `--iwb-layer2`(也是 `#1c1c1c`)——改数字没用,
因为它俩就是同一个颜色。改为 `color-mix(text 10%, transparent)`。任务卡里的「等待」按钮同理。
+4 -1
View File
@@ -117,7 +117,10 @@ button { font-family: inherit; }
.iwb-grow { flex: 1; }
.iwb-row { display: flex; gap: 6px; align-items: center; }
.iwb-actions { margin-top: 8px; }
.iwb-port { position: absolute; width: 12px; height: 12px; border-radius: 50%; background: var(--iwb-field); border: 1.5px solid var(--iwb-border2); transform: translate(-50%, -50%); z-index: 7; }
/* 端口描边不能吃 --iwb-border2:深色下它是 #4d4d4d,与端口填充 --iwb-field(#494949) 同色,
描边等于没有,12px 的小圆点会糊成一团。改用「文字色 55%」派生:
亮 #828282 / 暗 #9e9e9e,对填充各 4.6:1 / 3.4:1(非文字元素红线 3:1),两个主题都是同一档锐度。 */
.iwb-port { position: absolute; width: 12px; height: 12px; border-radius: 50%; background: var(--iwb-field); border: 1.5px solid color-mix(in srgb, var(--iwb-text) 55%, transparent); transform: translate(-50%, -50%); z-index: 7; }
.iwb-node:hover .iwb-port { border-color: var(--iwb-brand); background: var(--iwb-field); }
.iwb-port:hover { border-color: var(--iwb-brand) !important; box-shadow: 0 0 0 4px color-mix(in srgb, var(--iwb-brand) 25%, transparent); }
.iwb-port::after { content: ''; position: absolute; inset: -9px; border-radius: 50%; }
Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 67 KiB

+6
View File
@@ -44,6 +44,12 @@ assert.deepStrictEqual(
const port = blocks.find((b) => b.sel === '.iwb-port')
assert.ok(port, '找不到 .iwb-port 规则')
assert.ok(port.body.includes('background: var(--iwb-field)'), '.iwb-port 底色必须是 --iwb-field')
// 描边必须由文字色派生:深色下 --iwb-border2 是 #4d4d4d,与填充 --iwb-field(#494949) 同色,
// 描边等于没有,12px 的小圆点会糊成一团。这条断言守的是「边缘锐度」而不只是「颜色对」。
assert.ok(
/border:\s*1\.5px solid color-mix\(in srgb, var\(--iwb-text\)/.test(port.body),
'.iwb-port 描边必须由 --iwb-text 派生(--iwb-border2 在深色下与填充同色,端口边缘会糊)'
)
for (const sel of ['.iwb-node:hover .iwb-port', '.iwb-port:hover', '.iwb-node-selected .iwb-port:not(.iwb-port-linked)']) {
const b = blocks.find((x) => x.sel === sel)
assert.ok(b, '找不到规则:' + sel)