#!/usr/bin/env python3
"""
simpleicons2img — fetch a brand logo from Simple Icons (simpleicons.org) and
render it as a square avatar image.

Examples
--------
    python simpleicons2img.py python
    python simpleicons2img.py github --bg "#0d1117" --fg white -r 1024 -f webp
    python simpleicons2img.py spotify --fg "#1DB954" --radius 0.5 -o spotify.png
    python simpleicons2img.py x --bg transparent        # transparent PNG

Names use Simple Icons "slugs": lowercase, no spaces (e.g. "Adobe Photoshop"
-> "adobephotoshop", "GitHub" -> "github"). Inputs are lowercased and spaces
stripped automatically; for anything unusual look up the slug at
https://simpleicons.org.

Note on colors: Simple Icons logos are single-color shapes, so `--fg` sets the
whole logo color (default black). This tool fetches the uncolored source SVGs
directly from the Simple Icons project so recoloring is exact; the
cdn.simpleicons.org endpoint bakes a color in, which would override --fg.

Requires: cairosvg + pillow  (only for raster output; svg output needs neither).
"""

from icon2img import IconSource, run

SIMPLE_ICONS = IconSource(
    key="simpleicons",
    prog_name="simpleicons2img",
    description="Fetch a Simple Icons brand logo and render it as a square avatar.",
    url_template=(
        "https://raw.githubusercontent.com/simple-icons/simple-icons/master/"
        "icons/{name}.svg"
    ),
    render_mode="fill",
    browse_url="https://simpleicons.org",
    icon_arg_help="Simple Icons slug, e.g. 'python' or 'github'",
    slug_style="compact",
    not_found_hint="look up the exact slug",
)

if __name__ == "__main__":
    run(SIMPLE_ICONS)
