anybadge
Simple, flexible badge generator for project badges.
What it is and what it does
anybadge is a Python library and CLI tool for generating SVG badge images with dynamic coloring based on threshold rules. It lets you create badges by specifying a label, value, and a set of thresholds that map numeric ranges to colors—so a pylint score of 2.22 can automatically render red, while higher scores render green. The package supports both named colors (from Mozilla's CSS color keywords) and hex color codes.
You can use it either by importing into Python code or by running commands directly from the shell. It's designed for projects that need badge generation without calling external services, making it useful for internal development, CI/CD pipelines, or environments where external badge services are unavailable or undesirable. The single dependency (packaging) and pure-Python wheel keep installation friction minimal.
Use it for:
- Generate pylint or code-quality score badges that change color based on thresholds in CI/CD pipelines.
- Create custom metric badges for internal dashboards or README files without relying on external badge services.
- Automate badge generation in build scripts to reflect real-time project health metrics.
- Generate badges for documentation completeness or API compliance status with threshold-driven colors.
- Build badges with both named colors and custom hex values for consistent project branding.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Generates SVG badge images with configurable thresholds and colors, usable as a Python library or command-line tool for adding badges to projects.
Yes. anybadge is a lightweight, actively maintained tool with no security issues, permissive licensing, and low install friction. It solves a specific, real problem—generating SVG badges with threshold-based coloring—and is well-suited for CI/CD integration, internal projects, or any scenario where you need badge generation without external dependencies.
Install
anybadge on PyPI
pip
pip install anybadgeuv
uv add anybadgepoetry
poetry add anybadgeInstalling anybadge
Before you install
Low friction: pure Python wheel with a single runtime dependency (packaging). Active maintenance with recent release (2025-01-11) and no known vulnerabilities.
License in practice
MIT license (permissive): you can use, modify, and distribute anybadge freely in commercial and private projects with minimal restrictions.
Quickstart
pip install anybadge
import anybadge
thresholds = {2: 'red', 4: 'orange', 8: 'yellow', 10: 'green'}
badge = anybadge.Badge('pylint', 2.22, thresholds=thresholds)
badge.write_badge('pylint.svg')
Verify before relying
- Whether pre-built badge templates (e.g., 'pylint') cover your specific metrics or if custom thresholds are always required.
- Performance characteristics when generating many badges in batch or in high-frequency CI/CD pipelines.
- Specific use-case coverage for test coverage badges or other common metrics beyond the documented examples.
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.7) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — packaging |
| Maintenance | actively maintained — 580 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,914,191/month — #3,436 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: anybadge-1.16.0-py3-none-any.whl
Tags
More Build Tools packages
Provides reusable utilities for Python…
permissive · top 100 on PyPI
tqdmWraps any iterable to display a real-time…
copyleft · top 100 on PyPI
pippip is the standard installer for Python…
permissive · top 100 on PyPI
hatchlingHatchling is a standards-compliant Python build…
permissive · top 100 on PyPI
grpcio-toolsGenerates Python gRPC service stubs and message…
permissive · top 1,000 on PyPI
pre-commitpre-commit is a framework for installing and…
permissive · top 1,000 on PyPI
coverage-badgeGenerates SVG coverage badges from Coverage.py…
permissive · top 15,000 on PyPI
genbadgeGenerates SVG badges for CI/CD tools and test…
permissive · top 15,000 on PyPI
drawsvgProgrammatically generate SVG images and…
permissive · top 5,000 on PyPI
colourmapGenerates unique RGB and HEX colors from input…
permissive · top 15,000 on PyPI
simple-colorsAdds colored and styled text output to terminal…
unclear · top 15,000 on PyPI
pdf417genEncodes text and binary data into PDF417 2D…
permissive · top 15,000 on PyPI
ansicolorsEmbeds ANSI color and style codes into Python…
permissive · top 5,000 on PyPI
ascii-colorsUnified terminal UI library providing colored…
permissive · top 15,000 on PyPI
colorfulColorful applies ANSI color and text styling to…
permissive · top 5,000 on PyPI
svgelementssvgelements parses SVG files and provides…
permissive · top 5,000 on PyPI