调整关系图外框层级配色并移除发光效果

This commit is contained in:
liuwei
2026-04-27 10:05:06 +08:00
parent d2c766eec9
commit 55723519aa
2 changed files with 23 additions and 60 deletions

View File

@@ -1511,9 +1511,7 @@ class ValueRankPlugin(MessagePluginInterface):
bx, by = pos_map[b]
normalized = max(0.12, min(score / max_edge_score, 1.0))
stroke_width = 1.35 + 6.5 * normalized
glow_width = stroke_width + 3.6
opacity = 0.20 + 0.48 * normalized
glow_opacity = 0.10 + 0.22 * normalized
edge_gradient_id = f"edge_gradient_{edge_idx}"
start_color = "#50D6FF"
end_color = "#FFBB5C" if (a == strongest_uid or b == strongest_uid) else "#6C92FF"
@@ -1524,11 +1522,6 @@ class ValueRankPlugin(MessagePluginInterface):
f'<stop offset="100%" stop-color="{end_color}" stop-opacity="0.90"></stop>'
f'</linearGradient>'
)
edge_svg_parts.append(
f'<line x1="{ax:.1f}" y1="{ay:.1f}" x2="{bx:.1f}" y2="{by:.1f}" '
f'stroke="rgba(84, 214, 255, {glow_opacity:.3f})" stroke-width="{glow_width:.2f}" '
f'stroke-linecap="round" filter="url(#edgeGlow)" />'
)
edge_svg_parts.append(
f'<line x1="{ax:.1f}" y1="{ay:.1f}" x2="{bx:.1f}" y2="{by:.1f}" '
f'stroke="url(#{edge_gradient_id})" stroke-opacity="{opacity:.3f}" '
@@ -1560,8 +1553,7 @@ class ValueRankPlugin(MessagePluginInterface):
edge_label_parts.append(
f'<g transform="translate({label_x:.1f},{label_y:.1f}) rotate({angle_deg:.1f})">'
f'<rect x="-{label_width / 2:.1f}" y="-11" width="{label_width:.1f}" height="22" '
f'rx="7" ry="7" fill="rgba(16,38,74,0.68)" stroke="rgba(84,214,255,0.34)" stroke-width="1.0" '
f'filter="url(#panelSoftGlow)"></rect>'
f'rx="7" ry="7" fill="rgba(16,38,74,0.68)" stroke="rgba(84,214,255,0.34)" stroke-width="1.0"></rect>'
f'<text x="0" y="4" text-anchor="middle" font-size="11" fill="#EAF7FF">{safe_label}</text>'
f'</g>'
)
@@ -1585,14 +1577,22 @@ class ValueRankPlugin(MessagePluginInterface):
avatar_url = _build_avatar_data_url(str(cm.get_head_image(uid) or "").strip(), uid)
ring_idx = int(node_meta_map.get(uid, {}).get("ring_idx", 0))
# 使用“连接度越高环线越偏暖”的视觉策略,帮助快速识别核心节点。
ring_color = "rgba(255, 176, 58, 0.96)" if size_norm >= 0.6 else "rgba(74, 141, 255, 0.96)"
glow_color = "rgba(255, 205, 111, 0.30)" if size_norm >= 0.6 else "rgba(84, 214, 255, 0.26)"
orbit_color = "rgba(255, 211, 130, 0.74)" if size_norm >= 0.6 else "rgba(113, 228, 255, 0.72)"
node_svg_parts.append(
f'<circle cx="{x:.1f}" cy="{y:.1f}" r="{node_radius + 7.4:.1f}" fill="{glow_color}" '
f'filter="url(#nodeGlow)"></circle>'
)
# 外框颜色按层级区分,而不是统一蓝金:
# 1. 核心层用暖金色,强调中心;
# 2. 第二层用青蓝色,形成科技感主色;
# 3. 外围层逐步过渡到蓝紫与浅蓝,方便一眼识别层次。
if ring_idx == 0:
ring_color = "rgba(255, 176, 58, 0.98)"
orbit_color = "rgba(255, 211, 130, 0.80)"
elif ring_idx == 1:
ring_color = "rgba(69, 212, 255, 0.96)"
orbit_color = "rgba(128, 238, 255, 0.72)"
elif ring_idx == 2:
ring_color = "rgba(93, 142, 255, 0.94)"
orbit_color = "rgba(148, 181, 255, 0.66)"
else:
ring_color = "rgba(145, 150, 255, 0.90)"
orbit_color = "rgba(188, 192, 255, 0.60)"
node_svg_parts.append(
f'<circle cx="{x:.1f}" cy="{y:.1f}" r="{node_radius + 2.8:.1f}" fill="rgba(255,255,255,0.88)" '
f'stroke="{ring_color}" stroke-width="3.4"></circle>'
@@ -1643,7 +1643,7 @@ class ValueRankPlugin(MessagePluginInterface):
]
crown_points_text = " ".join([f"{px:.1f},{py:.1f}" for px, py in crown_points])
node_svg_parts.append(
f'<g filter="url(#crownGlow)">'
f'<g>'
f'<rect x="{x - 15.0:.1f}" y="{crown_y + 18.0:.1f}" width="30.0" height="5.5" rx="2.8" ry="2.8" '
f'fill="rgba(255, 183, 3, 0.98)" stroke="rgba(168, 104, 0, 0.85)" stroke-width="1.0"></rect>'
f'<polygon points="{crown_points_text}" fill="rgba(255, 202, 40, 0.98)" '
@@ -1657,17 +1657,16 @@ class ValueRankPlugin(MessagePluginInterface):
# “连接人数”改成贴在头像上的数字徽标:
# 1. 用户反馈原先那行“连接x · 分数y”混在线条里看不清
# 2. 数字徽标直接挂在节点边缘,读图时更像“这个人连了多少人”;
# 3. 图里移除分数展示,只保留更关键的连接人数,减少认知负担
# 3. 这里再往头像外侧推一点,避免遮住头像主体内容
badge_text = str(int(partner_count))
badge_font_size = 11 if len(badge_text) <= 2 else 10
badge_width = 16.0 + len(badge_text) * 7.5
badge_height = 20.0
badge_x = x + node_radius * 0.58 - badge_width / 2.0
badge_y = y + node_radius * 0.55 - badge_height / 2.0
badge_x = x + node_radius * 0.98 - badge_width / 2.0
badge_y = y - node_radius * 0.92 - badge_height / 2.0
node_svg_parts.append(
f'<rect x="{badge_x:.1f}" y="{badge_y:.1f}" width="{badge_width:.1f}" height="{badge_height:.1f}" '
f'rx="10" ry="10" fill="rgba(17, 41, 79, 0.84)" stroke="{ring_color}" stroke-width="1.6" '
f'filter="url(#panelSoftGlow)"></rect>'
f'rx="10" ry="10" fill="rgba(17, 41, 79, 0.84)" stroke="{ring_color}" stroke-width="1.6"></rect>'
)
node_svg_parts.append(
f'<text x="{badge_x + badge_width / 2.0:.1f}" y="{badge_y + 13.2:.1f}" text-anchor="middle" '
@@ -1688,8 +1687,7 @@ class ValueRankPlugin(MessagePluginInterface):
label_box_y = title_y - 18.0
node_svg_parts.append(
f'<rect x="{label_box_x:.1f}" y="{label_box_y:.1f}" width="{label_width:.1f}" height="{label_height:.1f}" '
f'rx="12" ry="12" fill="rgba(14, 33, 66, 0.66)" stroke="rgba(84,214,255,0.24)" stroke-width="1.0" '
f'filter="url(#panelSoftGlow)"></rect>'
f'rx="12" ry="12" fill="rgba(14, 33, 66, 0.66)" stroke="rgba(84,214,255,0.24)" stroke-width="1.0"></rect>'
)
node_svg_parts.append(
f'<text x="{title_x:.1f}" y="{title_y:.1f}" text-anchor="{anchor}" '

View File

@@ -81,41 +81,6 @@
<path d="M 32 0 L 0 0 0 32" fill="none" stroke="rgba(110,168,214,0.10)" stroke-width="1"></path>
<circle cx="0" cy="0" r="1.4" fill="rgba(82,215,255,0.16)"></circle>
</pattern>
<filter id="edgeGlow" x="-60%" y="-60%" width="220%" height="220%">
<feGaussianBlur stdDeviation="3.2" result="blur"></feGaussianBlur>
<feMerge>
<feMergeNode in="blur"></feMergeNode>
<feMergeNode in="SourceGraphic"></feMergeNode>
</feMerge>
</filter>
<filter id="nodeGlow" x="-80%" y="-80%" width="260%" height="260%">
<feGaussianBlur stdDeviation="6" result="blur"></feGaussianBlur>
<feColorMatrix
in="blur"
type="matrix"
values="1 0 0 0 0
0 1 0 0 0
0 0 1 0 0
0 0 0 0.36 0"></feColorMatrix>
<feMerge>
<feMergeNode></feMergeNode>
<feMergeNode in="SourceGraphic"></feMergeNode>
</feMerge>
</filter>
<filter id="panelSoftGlow" x="-20%" y="-20%" width="140%" height="140%">
<feGaussianBlur stdDeviation="2.2" result="blur"></feGaussianBlur>
<feMerge>
<feMergeNode in="blur"></feMergeNode>
<feMergeNode in="SourceGraphic"></feMergeNode>
</feMerge>
</filter>
<filter id="crownGlow" x="-60%" y="-60%" width="220%" height="220%">
<feGaussianBlur stdDeviation="2.6" result="blur"></feGaussianBlur>
<feMerge>
<feMergeNode in="blur"></feMergeNode>
<feMergeNode in="SourceGraphic"></feMergeNode>
</feMerge>
</filter>
__EDGE_DEFS__
__NODE_DEFS__
</defs>