Repository navigation
refactor(site): 节点主色统一从 CSS 变量读取,消除双数据源 - #8
Merged
Merged
Conversation
右栏图注用 var(--gold) 等 CSS 变量着色,而 vis-network 节点此前硬编码 '#f5b301' —— 这是两份独立定义。当前值恰好一致,但任改其一都会导致图注 与图谱颜色对不上,属于迟早漂移的设计缺陷。改为 JS 从 CSS 变量读取。 - 新增 cssVar():getComputedStyle 读取 + trim + fallback - fallback 保留原色值:CSS 未加载时(Pages 资源 404)不会退回 vis-network 默认蓝,避免「所有节点一个色」这种更难排查的现象 - border 色与顶层类型特殊色 '#2f9e54' 仍硬编码:图注不描述边框,CSS 里 也没有对应变量,为其新增变量反而增加维护面 注:本次改动不声称修复了「图注与实际颜色不一致」的报告现象——静态分析 (节点数据 / groupColors / CSS 变量 / 线上内容 / 运行时覆盖 / graphOptions) 九项均未复现该问题,需实机渲染或截图才能定位。本次只是消除双数据源隐患。 验证(Node 模拟,输入取自真实构建产物 site/assets/index.css 的变量值): - 五个 group 主色与对应 CSS 变量逐一相等 - 五色互不相同(无串位) - CSS 变量全部缺失时 fallback 五项均生效 - 返回值带前导/尾随空格时 trim 正常(浏览器常见行为)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
右栏图注用 var(--gold) 等 CSS 变量着色,而 vis-network 节点此前硬编码 '#f5b301' —— 这是两份独立定义。当前值恰好一致,但任改其一都会导致图注
与图谱颜色对不上,属于迟早漂移的设计缺陷。改为 JS 从 CSS 变量读取。
注:本次改动不声称修复了「图注与实际颜色不一致」的报告现象——静态分析
(节点数据 / groupColors / CSS 变量 / 线上内容 / 运行时覆盖 / graphOptions) 九项均未复现该问题,需实机渲染或截图才能定位。本次只是消除双数据源隐患。
验证(Node 模拟,输入取自真实构建产物 site/assets/index.css 的变量值):