(path: str)
| 25 | |
| 26 | |
| 27 | def safe_symbol_from_path(path: str) -> str: |
| 28 | raw = path.replace("\\", "/") |
| 29 | base = raw.split("/")[-1] or raw |
| 30 | no_ext = re.sub(r"\.[a-z0-9]+$", "", base, flags=re.I) |
| 31 | sym = re.sub(r"[^a-zA-Z0-9_]", "_", no_ext) |
| 32 | return sym or "icon" |
| 33 | |
| 34 | |
| 35 | def hex_to_rgb(hex_str: str) -> tuple[int, int, int]: |