fix(3 U2): inline-SVG sunflower + font-safe cap line for headless card render
Headless chromium has no colour-emoji font, so 🌻/🏆/⚑ rendered as tofu boxes in the PNG card. Replace with a self-contained inline-SVG sunflower + plain-text 'capped:'/'full clean climb' markers. The U3 PR comment keeps the real 🌻 emoji (Gitea markdown renders it). Pure render change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@ -41,6 +41,19 @@ STATUS_COLOR = {
|
||||
}
|
||||
|
||||
|
||||
# Inline-SVG sunflower (🌻) for the card header. Self-contained so it renders deterministically in
|
||||
# headless chromium, which has no colour-emoji font (the PR comment in U3 keeps the real 🌻 emoji —
|
||||
# Gitea markdown renders it). 8 petals around a seed disc.
|
||||
_PETALS = "".join(
|
||||
f'<ellipse cx="14" cy="5.5" rx="2.6" ry="5.5" transform="rotate({a} 14 14)"/>'
|
||||
for a in range(0, 360, 45)
|
||||
)
|
||||
FLOWER_SVG = (
|
||||
'<svg class="flower" width="30" height="30" viewBox="0 0 28 28" aria-label="cc-ci">'
|
||||
f'<g fill="#f0b429">{_PETALS}</g><circle cx="14" cy="14" r="5" fill="#7a4f1d"/></svg>'
|
||||
)
|
||||
|
||||
|
||||
def level_color(level: int) -> str:
|
||||
return LEVEL_COLOR.get(int(level), "#8b949e")
|
||||
|
||||
@ -125,7 +138,7 @@ def render_card_html(data: dict, screenshot_rel: str | None = "screenshot.png")
|
||||
body{{margin:0;font-family:system-ui,-apple-system,Segoe UI,sans-serif;background:#0d1117;color:#c9d1d9}}
|
||||
.card{{width:900px;background:#161b22;border:1px solid #30363d;border-radius:12px;overflow:hidden}}
|
||||
.hd{{display:flex;align-items:center;gap:1rem;padding:1.1rem 1.3rem;border-bottom:1px solid #30363d}}
|
||||
.flower{{font-size:1.8rem}}
|
||||
.flower{{flex:none}}
|
||||
.title{{flex:1}}
|
||||
.title h1{{margin:0;font-size:1.4rem}}
|
||||
.title .ver{{color:#8b949e;font-size:.9rem}}
|
||||
@ -149,11 +162,12 @@ tr.stage td{{padding-top:.5rem;border-bottom:1px solid #30363d}}
|
||||
.shot.noshot{{display:flex;align-items:center;justify-content:center;height:225px;color:#8b949e;font-size:.85rem}}
|
||||
.flags{{display:flex;gap:.6rem;padding:.6rem 1.3rem 1rem}}
|
||||
.flag{{border:1px solid;border-radius:6px;padding:.15rem .5rem;font-size:.78rem;color:#c9d1d9}}
|
||||
.cap b{{color:#c9d1d9}}
|
||||
</style></head><body><div class="card">
|
||||
<div class="hd"><span class="flower">🌻</span>
|
||||
<div class="hd">{FLOWER_SVG}
|
||||
<div class="title"><h1>{recipe}</h1><span class="ver">{version}</span></div>
|
||||
<div class="lvl"><span class="num">{level}</span><span class="lbl">level</span></div></div>
|
||||
<div class="cap">{("⚑ " + cap) if cap else "🏆 full clean climb (level 6)"}</div>
|
||||
<div class="cap">{("<b>capped:</b> " + cap) if cap else "<b>full clean climb</b> — top level (6)"}</div>
|
||||
<div class="body"><div class="tbl"><table>{rows}</table></div>{shot_html}</div>
|
||||
<div class="flags">{"".join(flag_bits)}</div>
|
||||
</div></body></html>"""
|
||||
|
||||
Reference in New Issue
Block a user