fix(assets): address PR #119 review round 2 — biomes.toml, legend, profile table
1. Add 5 extended atmosphere colors to biomes.toml (globe renderer reads
from toml, not body_def) — cold_arid, hot_arid, tropical, boreal,
temperate_terminator. Remove dead martian entry. Slightly differentiate
colors from base classes.
2. Fix profile table raw identifiers — apply .replace('_', ' ') to class
field in wiki body pages.
3. Fix legend text overflow — truncate labels with ellipsis when step
size is too narrow for full text.
4. Fix title panel underscores — use .replace('_', ' ') instead of
.replace('_ringed', '').
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -282,7 +282,7 @@ def _render_title(img: Image.Image, body_def: dict) -> Image.Image:
|
||||
|
||||
name = body_def.get("name") or body_def.get("id", "Unknown")
|
||||
bid = body_def.get("id", "")
|
||||
pclass = body_def.get("planet_class", "").replace("_ringed", "")
|
||||
pclass = body_def.get("planet_class", "").replace("_", " ")
|
||||
star = body_def.get("star", {})
|
||||
orbit = body_def.get("orbit", {})
|
||||
phys = body_def.get("physical", {})
|
||||
@@ -370,10 +370,19 @@ def _render_legend(img: Image.Image, terrain: dict) -> Image.Image:
|
||||
max_step = (OUT_W - 2 * pad_x) // max(max_items, 1)
|
||||
step = min(int(108 * UI_SCALE), max_step)
|
||||
|
||||
# Max label width = step minus swatch minus gaps
|
||||
max_label_px = step - sw - gap - int(4 * UI_SCALE)
|
||||
|
||||
lx = pad_x
|
||||
for label, rgb in items:
|
||||
draw.rectangle([(lx, leg_y), (lx + sw, leg_y + sh)], fill=rgb)
|
||||
draw.text((lx + sw + gap, leg_y), label,
|
||||
# Truncate label to fit allocated space
|
||||
display = label
|
||||
while display and draw.textlength(display, font=font) > max_label_px:
|
||||
display = display[:-1]
|
||||
if display != label and display:
|
||||
display = display[:-1] + "…"
|
||||
draw.text((lx + sw + gap, leg_y), display,
|
||||
fill=(185, 192, 205), font=font)
|
||||
lx += step
|
||||
|
||||
|
||||
Reference in New Issue
Block a user