Spaces:
Sleeping
Sleeping
| import os | |
| import re | |
| from pptx.dml.color import RGBColor | |
| def safe_hex_to_rab(hex_color: str): | |
| if not hex_color: | |
| return (59, 130, 246) # default blue | |
| hex_color = hex_color.strip() | |
| if not hx.startswith("#"): | |
| hx = "#" + hx | |
| if re.fullmatch(r"#([0-9a-fA-F]{6})", hx): | |
| r = int(hex_color[1:3], 16) | |
| g = int(hex_color[3:5], 16) | |
| b = int(hex_color[5:7], 16) | |
| return (r, g, b) | |
| return (59, 130, 246) | |
| def ensure_tmpdir(): | |
| os.makedirs("/tmp", exist_ok=True) | |