feat(plugin-theme): 四层插件配色规范 + 作用域重映射 + 底色深浅(v3.25.89)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 35s

This commit is contained in:
qiqi committed 2026-11-21 11:03:57 +08:00
1 parent 35ac37fb45
commit f4e4ca5649
14 files changed
+158 -23

No files matched your search

+17 -2
View File
@@ -58,10 +58,12 @@
return out
}
const DEFAULTS = { seedNeutral: '#808080', seedAccent: '#6b7280', depth: 22 }
const DEFAULTS = { seedNeutral: '#808080', seedAccent: '#6b7280', depth: 22, pluginTint: 12 }
function derive (cfg, dark) {
const c = cfg || {}
const tintRaw = Number(c.pluginTint)
const pluginTint = Math.max(0, Math.min(30, Number.isFinite(tintRaw) ? tintRaw : DEFAULTS.pluginTint))
const N = normHex(c.seedNeutral) || DEFAULTS.seedNeutral
const A = normHex(c.seedAccent) || DEFAULTS.seedAccent
const depth = Math.max(0, Math.min(60, Number(c.depth) === undefined ? DEFAULTS.depth : Number(c.depth)))
@@ -87,6 +89,14 @@
const edgeHot = d ? mix(A, '#ffffff', 0.25) : A
const gridDot = mix(N, t, d ? 0.36 : 0.30)
// 插件面板四层(v3.25.89):面板浅灰 / 卡片白 / 内嵌更灰 / 悬停最灰
const dockBg = mix(surface3, canvas, 0.45)
const pTint = pluginTint / 100
const pluginSurface = mix(surface1, dockBg, pTint)
const pluginCard = d ? mix(surface1, '#ffffff', 0.07) : '#ffffff'
const pluginInset = mix(surface1, dockBg, Math.min(0.7, pTint + 0.10))
const pluginHover = mix(pluginSurface, border2, d ? 0.28 : 0.16)
// 语义色:色相固定,明度随主题调整(暗色提亮一档,避免发闷)
const err = d ? mix('#ef4444', '#ffffff', 0.18) : '#ef4444'
const ok = d ? mix('#22c55e', '#ffffff', 0.18) : '#22c55e'
@@ -96,6 +106,7 @@
return {
err, ok, warn, onBrand,
pluginSurface, pluginCard, pluginInset, pluginHover,
bg: surface0,
panel: surface1,
layer,
@@ -104,7 +115,7 @@
canvasBg: canvas,
chrome: mix(surface0, canvas, 0.4),
homeBg: mix(surface0, canvas, 0.35),
dockBg: mix(surface3, canvas, 0.45),
dockBg,
dockHeadBg: mix(mix(surface3, canvas, 0.45), '#000000', 0.06),
border,
border2,
@@ -143,6 +154,10 @@
s('--iwb-ok', tokens.ok)
s('--iwb-warn', tokens.warn)
s('--iwb-on-brand', tokens.onBrand)
s('--iwb-plugin-surface', tokens.pluginSurface)
s('--iwb-plugin-card', tokens.pluginCard)
s('--iwb-plugin-inset', tokens.pluginInset)
s('--iwb-plugin-hover', tokens.pluginHover)
}
global.IWBThemeTokens = { DEFAULTS, derive, applyTo, mix, contrast, clampText }
+6 -2
View File
@@ -16,7 +16,7 @@
canvasBgLight: '#d9dbde', canvasBgDark: '#6f6f6f',
gridDotLight: '#c9ccd6', gridDotDark: '#8f8f8f', gridSize: 1.4, gridGap: 22, gridOn: true, gridStyle: 'dots',
// v3.25.81:自动配色(默认开)——只定 4 个种子,其余由 src/theme-tokens.js 派生
auto: true, seedNeutral: '#808080', seedAccent: '#6b7280', depth: 22,
auto: true, seedNeutral: '#808080', seedAccent: '#6b7280', depth: 22, pluginTint: 12,
edgeColorLight: '#b9bfca', edgeColorDark: '#7a7a7a',
edgeWidth: 1.8, edgeDash: 'dashed',
edgeHotLight: '#6b7280', edgeHotDark: '#ffffff',
@@ -64,6 +64,7 @@
seedNeutral: normHex(c.seedNeutral) || DEFAULTS.seedNeutral,
seedAccent: normHex(c.seedAccent) || DEFAULTS.seedAccent,
depth: clamp(c.depth, 0, 60, DEFAULTS.depth),
pluginTint: clamp(c.pluginTint, 0, 30, DEFAULTS.pluginTint),
nodeBgLight: hex('nodeBgLight'), nodeBgDark: hex('nodeBgDark'),
nodeBorderLight: hex('nodeBorderLight'), nodeBorderDark: hex('nodeBorderDark'),
nodeRadius: clamp(c.nodeRadius, 6, 20, DEFAULTS.nodeRadius),
@@ -398,8 +399,11 @@
Row('强调色', el(ColorPicker, { value: value.seedAccent, onChange: (v) => set({ seedAccent: v, auto: true }) }), '按钮 / 端口 / 选中框'),
], ['auto', 'seedNeutral', 'seedAccent', 'depth'])
const pluginGroup = Group('插件面板', [
Row('底色深浅', el('input', { type: 'range', min: 0, max: 30, step: 1, value: value.pluginTint, className: 'iwb-appear-range', onChange: (e) => set({ pluginTint: Number(e.target.value) }) }), String(value.pluginTint)),
], ['pluginTint'])
return el('div', { className: 'iwb-appear' },
autoGroup, themeGroup, value.auto ? el('div', { className: 'iwb-appear-note-only' }, '自动配色已开启;关闭后可逐项微调(画布 / 连线 / 节点)。') : canvasGroup, value.auto ? null : edgeGroup, value.auto ? null : nodeGroup,
autoGroup, themeGroup, pluginGroup, value.auto ? el('div', { className: 'iwb-appear-note-only' }, '自动配色已开启;关闭后可逐项微调(画布 / 连线 / 节点)。') : canvasGroup, value.auto ? null : edgeGroup, value.auto ? null : nodeGroup,
el('div', { className: 'iwb-row', style: { marginTop: 12 } },
el('button', { className: 'iwb-btn iwb-btn-sm', onClick: () => set(Object.assign({}, DEFAULTS, { presets: value.presets })) }, '全部恢复默认')))
}