"""SVG helper functions and utilities.""" def escape(text: str) -> str: """Escape special characters for SVG text.""" return text.replace("&", "&").replace("<", "<").replace(">", ">").replace('"', """) def card_wrapper(inner_svg: str, width: int, height: int, theme: dict, title: str = "", id_prefix: str = "") -> str: """Wraps content in a styled card with rounded corners and border. Args: id_prefix: Optional prefix for SVG IDs to avoid conflicts when multiple widgets are inlined in the same document. """ shadow_id = f"{id_prefix}shadow" if id_prefix else "shadow" clip_id = f"{id_prefix}avatarClip" if id_prefix else "avatarClip" return f''' {f'{escape(title.upper())}' if title else ''} {inner_svg} ''' def icon_svg(kind: str, color: str) -> str: """Returns SVG for stat icons (14x14).""" icons = { "commits": f'', "prs": f'', "stars": f'', "repos": f'', "followers": f'', } return f'{icons.get(kind, "")}'