#!/usr/bin/env python3
"""Generate Illuscape document templates."""
from pathlib import Path
TEMPLATES_DIR = Path("config/templates")
def mm_to_px(mm: float) -> float:
return mm * 3.7795275591 # 96 dpi
def in_to_px(inches: float) -> float:
return inches * 96.0
def svg(name: str, width_px: float, height_px: float,
units: str, bleed_mm: float = 0.0, note: str = "") -> str:
import math
bleed_px = mm_to_px(bleed_mm)
guides = ""
if bleed_mm > 0:
guides = f"""
"""
comment = f"" if note else ""
return f"""
{comment}
"""
specs = [
("Letter", in_to_px(8.5), in_to_px(11), "in", 0, "US Letter portrait"),
("A4", mm_to_px(210), mm_to_px(297), "mm", 0, "A4 portrait"),
("Web-1920x1080", 1920, 1080, "px", 0, "HD web canvas"),
("Web-1280x720", 1280, 720, "px", 0, "HD web canvas (smaller)"),
("Print-CMYK-Letter", in_to_px(8.5), in_to_px(11), "in", 3, "US Letter with 3mm bleed. Note: Inkscape is RGB-native; set CMYK values manually."),
("Print-CMYK-A4", mm_to_px(210), mm_to_px(297), "mm", 3, "A4 with 3mm bleed. Note: Inkscape is RGB-native; set CMYK values manually."),
]
for name, w, h, units, bleed, note in specs:
path = TEMPLATES_DIR / f"{name}.svg"
path.write_text(svg(name, w, h, units, bleed, note))
print(f"✓ {path}")