feat: E1002 顶部时钟改 F84+用量行 12px 三档配色、标签右对齐
- 顶部时钟 F48→F84 占满 A 段,星期/日期移到时钟右侧并与基线对齐 - 用量行:标签常规字重右对齐贴进度条,百分比与 pace 数字 12px 粗体 - 配色:进度条/边框/百分比同色,用量与 pace 各自三档绿/黑/红、独立取色 (曾按要求加过黄档,同日被否并移除) - 用量块标题右侧「快照」改为「上次更新」,与今日实时统一 - 今日实时标题与指标名间距加大 4px - 基类抽出 PCT_TRACK / LABEL_BOLD / LABEL_ALIGN / FPACE 供宽版覆写, 400×300 小屏输出逐像素不变 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -56,15 +56,12 @@ html,body{width:800px;height:480px;overflow:hidden;background:#fff;color:#000;
|
||||
|
||||
|
||||
def _tier_bar(bar, usage):
|
||||
"""用量条颜色三档(与 renderer_e1002 一致)。返回 (填充/边框色, 百分比文字色)。"""
|
||||
"""用量条颜色三档 绿/黑/红(与 renderer_e1002 一致)。返回 (填充/边框色, 百分比文字色),两者同色。"""
|
||||
pct = bar.get("pct")
|
||||
if not isinstance(pct, (int, float)):
|
||||
return BLACK, BLACK
|
||||
if pct >= usage.get("warn", 80):
|
||||
return RED, RED
|
||||
if pct <= usage.get("ok", 30):
|
||||
return GREEN, BLACK
|
||||
return BLACK, BLACK
|
||||
c = RED if pct >= usage.get("warn", 80) else GREEN if pct <= usage.get("ok", 30) else BLACK
|
||||
return c, c
|
||||
|
||||
|
||||
def _tier_pace(diff, usage):
|
||||
@@ -73,7 +70,7 @@ def _tier_pace(diff, usage):
|
||||
|
||||
|
||||
def _usage_card(usage):
|
||||
note = "示例数据" if usage.get("mock") else (f'快照 {usage["updated"]}' if usage.get("updated") else "")
|
||||
note = "示例数据" if usage.get("mock") else (f'上次更新 {usage["updated"]}' if usage.get("updated") else "")
|
||||
rows = []
|
||||
for b in usage.get("bars", []):
|
||||
pct = b.get("pct")
|
||||
|
||||
Reference in New Issue
Block a user