76 lines
1.9 KiB
Python
76 lines
1.9 KiB
Python
|
|
"""
|
||
|
|
Lädt Feather Icons (MIT-Lizenz) von GitHub herunter und speichert sie in src/res/icons/.
|
||
|
|
Stroke-Farbe wird auf #444444 gesetzt für bessere Sichtbarkeit in hellen und dunklen Themes.
|
||
|
|
|
||
|
|
Ausführung: uv run python scripts/download_icons.py
|
||
|
|
"""
|
||
|
|
|
||
|
|
import urllib.request
|
||
|
|
from pathlib import Path
|
||
|
|
|
||
|
|
ICONS = [
|
||
|
|
"folder-plus",
|
||
|
|
"log-out",
|
||
|
|
"settings",
|
||
|
|
"folder",
|
||
|
|
"refresh-cw",
|
||
|
|
"plus-circle",
|
||
|
|
"minus-circle",
|
||
|
|
"play-circle",
|
||
|
|
"file",
|
||
|
|
"check-circle",
|
||
|
|
"info",
|
||
|
|
"git-branch",
|
||
|
|
"file-text",
|
||
|
|
"code",
|
||
|
|
"chevron-down",
|
||
|
|
"chevron-up",
|
||
|
|
"trash-2",
|
||
|
|
"file-plus",
|
||
|
|
"columns",
|
||
|
|
"sliders",
|
||
|
|
]
|
||
|
|
|
||
|
|
BASE_URL = "https://raw.githubusercontent.com/feathericons/feather/master/icons/{name}.svg"
|
||
|
|
OUTPUT_DIR = Path(__file__).parent.parent / "src" / "res" / "icons"
|
||
|
|
|
||
|
|
|
||
|
|
def download_icons():
|
||
|
|
OUTPUT_DIR.mkdir(parents=True, exist_ok=True)
|
||
|
|
|
||
|
|
success = 0
|
||
|
|
failed = []
|
||
|
|
|
||
|
|
for name in ICONS:
|
||
|
|
url = BASE_URL.format(name=name)
|
||
|
|
dest = OUTPUT_DIR / f"{name}.svg"
|
||
|
|
|
||
|
|
if dest.exists():
|
||
|
|
print(f" [OK] {name}.svg (bereits vorhanden)")
|
||
|
|
success += 1
|
||
|
|
continue
|
||
|
|
|
||
|
|
try:
|
||
|
|
with urllib.request.urlopen(url, timeout=10) as response:
|
||
|
|
content = response.read().decode("utf-8")
|
||
|
|
|
||
|
|
content = content.replace('stroke="#000000"', 'stroke="#444444"')
|
||
|
|
content = content.replace("stroke='#000000'", "stroke='#444444'")
|
||
|
|
|
||
|
|
dest.write_text(content, encoding="utf-8")
|
||
|
|
print(f" [OK] {name}.svg")
|
||
|
|
success += 1
|
||
|
|
|
||
|
|
except Exception as e:
|
||
|
|
print(f" [FEHLER] {name}.svg: {e}")
|
||
|
|
failed.append(name)
|
||
|
|
|
||
|
|
print(f"\n{success}/{len(ICONS)} Icons heruntergeladen nach {OUTPUT_DIR}")
|
||
|
|
if failed:
|
||
|
|
print(f"Fehlgeschlagen: {', '.join(failed)}")
|
||
|
|
|
||
|
|
|
||
|
|
if __name__ == "__main__":
|
||
|
|
print(f"Lade {len(ICONS)} Feather Icons herunter ...")
|
||
|
|
download_icons()
|