"""
SVG icon library for 金融日报 | Financial Daily
Usage: from scripts.icons import ICONS; print(ICONS['arrow_up'])
"""
ICONS = {
"arrow_up": """""",
"arrow_down": """""",
"arrow_right": """""",
"trending_up": """""",
"trending_down": """""",
"bank": """""",
"newspaper": """""",
"chart_bar": """""",
"dollar": """""",
"globe": """""",
"user": """""",
"calendar": """""",
"rss": """""",
"alert": """""",
"external_link": """""",
"refresh": """""",
}
def get_icon(name: str, size: int = 14, color: str = "currentColor") -> str:
"""Return an SVG icon string with optional size override."""
icon = ICONS.get(name, "")
if not icon:
return ""
icon = re.sub(r'width="\d+"', f'width="{size}"', icon)
icon = re.sub(r'height="\d+"', f'height="{size}"', icon)
if color != "currentColor":
icon = icon.replace('stroke="currentColor"', f'stroke="{color}"')
return icon
# Allow direct import without regex at module level
import re # noqa: E402 (import at end intentional — avoid circular at top)
if __name__ == "__main__":
print("Available icons:")
for name in ICONS:
print(f" {name}")