🎨 refine(stats): rebalance summary badge styling
Ubuntu System Information / show-system-info (push) Successful in 0s Details

This commit is contained in:
csh 2026-05-22 16:03:09 +08:00
parent 6552f8be47
commit 550e226a2b
2 changed files with 6 additions and 2 deletions

View File

@ -245,18 +245,21 @@ def main() -> None:
"代码",
f"{args.formatted_total_code}",
normalize_color(args.total_color, DEFAULT_TOTAL_COLOR),
variant="flat",
)
write_badge(
output_dir / "total-files.svg",
"文件",
f"{args.formatted_total_files}",
normalize_color(args.files_color, DEFAULT_FILES_COLOR),
variant="flat",
)
write_badge(
output_dir / "language-count.svg",
"语言",
f"{args.language_count}",
normalize_color(args.language_count_color, DEFAULT_LANGUAGE_COUNT_COLOR),
variant="flat",
)
for stat in languages:
@ -265,7 +268,7 @@ def main() -> None:
stat.display_name,
f"{stat.formatted_lines}",
stat.color,
variant="flat",
variant="split",
)
readme_path.write_text(render_readme(args, languages, badge_dir_name), encoding="utf-8")

View File

@ -44,7 +44,8 @@ test -f "${readme_path}" || fail "renderer should create root README.md"
grep -q '<svg' "${output_dir}/total-lines.svg" || fail "svg badges should contain svg markup"
grep -q '2,120' "${output_dir}/total-lines.svg" || fail "total-lines badge should include formatted total code"
grep -q 'Python' "${output_dir}/python-lines.svg" || fail "language badge should include display name"
! grep -q 'fill="#555555"' "${output_dir}/python-lines.svg" || fail "language badge should not use the heavy gray label background"
! grep -q 'fill="#555555"' "${output_dir}/total-lines.svg" || fail "summary badge should not use the heavy gray label background"
grep -q 'fill="#555555"' "${output_dir}/python-lines.svg" || fail "language badge should keep the split label style"
grep -q '\./badges/total-lines.svg' "${readme_path}" || fail "README should reference badges via relative svg paths"
grep -q '\./badges/python-lines.svg' "${readme_path}" || fail "README should reference language badges via relative svg paths"
! grep -q '^!\[总代码\](\./badges/total-lines.svg)$' "${readme_path}" || fail "README should not duplicate summary badges above the table"