mirror of
https://github.com/Michele-M-Media/HYPERHEN.git
synced 2026-10-22 08:32:20 -05:00
66 lines
2.5 KiB
Python
Executable File
66 lines
2.5 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""Apply the HyperHEN visual shell to the small Settings SVG glyphs."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import argparse
|
|
from pathlib import Path
|
|
import re
|
|
|
|
|
|
MARKER = "hyperhen-icon-theme-v1"
|
|
|
|
FRAME = f""" <!-- {MARKER} -->
|
|
<defs>
|
|
<linearGradient id="hh-frame" x1="9" y1="8" x2="55" y2="57" gradientUnits="userSpaceOnUse">
|
|
<stop stop-color="#45F4FF"/>
|
|
<stop offset="0.48" stop-color="#5B8CFF"/>
|
|
<stop offset="1" stop-color="#E13CFF"/>
|
|
</linearGradient>
|
|
<radialGradient id="hh-core" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(25 20) rotate(51) scale(48)">
|
|
<stop stop-color="#183C68"/>
|
|
<stop offset="0.5" stop-color="#0A1730"/>
|
|
<stop offset="1" stop-color="#050A18"/>
|
|
</radialGradient>
|
|
<filter id="hh-glow" x="-35%" y="-35%" width="170%" height="170%">
|
|
<feGaussianBlur stdDeviation="1.45" result="blur"/>
|
|
<feColorMatrix in="blur" type="matrix" values="0 0 0 0 0.12 0 0 0 0 0.82 0 0 0 0 1 0 0 0 .78 0"/>
|
|
</filter>
|
|
</defs>
|
|
<path d="M18 3.5H46L60.5 18V46L46 60.5H18L3.5 46V18L18 3.5Z" fill="#061022" fill-opacity="0.96" stroke="#122A4A"/>
|
|
<path d="M19 5H45L59 19V45L45 59H19L5 45V19L19 5Z" fill="url(#hh-core)" stroke="url(#hh-frame)" stroke-width="1.6"/>
|
|
<path d="M17 8H27M37 8H47M56 17V27M56 37V47M47 56H37M27 56H17M8 47V37M8 27V17" stroke="url(#hh-frame)" stroke-width="1.4" stroke-linecap="round" opacity="0.92"/>
|
|
<circle cx="32" cy="32" r="22" fill="none" stroke="#37E9FF" stroke-width="1" opacity="0.13"/>
|
|
<g transform="translate(8.32 8.32) scale(0.74)" opacity="0.55" filter="url(#hh-glow)">
|
|
"""
|
|
|
|
|
|
def theme(svg: str) -> str:
|
|
if MARKER in svg:
|
|
return svg
|
|
match = re.search(r"<svg\b[^>]*>", svg)
|
|
if not match:
|
|
raise ValueError("missing SVG root")
|
|
end = svg.rfind("</svg>")
|
|
if end < 0:
|
|
raise ValueError("missing SVG closing tag")
|
|
body = svg[match.end() : end].strip()
|
|
root = (
|
|
'<svg width="64" height="64" viewBox="0 0 64 64" fill="none" '
|
|
'xmlns="http://www.w3.org/2000/svg">\n'
|
|
)
|
|
return root + FRAME + body + "\n </g>\n <g transform=\"translate(8.32 8.32) scale(0.74)\">\n" + body + "\n </g>\n</svg>\n"
|
|
|
|
|
|
def main() -> int:
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument("directory", type=Path)
|
|
args = parser.parse_args()
|
|
for path in sorted(args.directory.glob("icon_xml_*.svg")):
|
|
path.write_text(theme(path.read_text(encoding="utf-8-sig")), encoding="utf-8")
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|