"""Development only: pip install resvg-py==0.5.0 Pillow. Render the pinned Lucide SVG originals into embedded, multi-resolution Windows icons. """ from pathlib import Path from io import BytesIO from PIL import Image import resvg_py import re import struct root = Path(__file__).resolve().parents[1] / 'resources' / 'icons' / 'lucide' names = ['circle-dot', 'arrow-up-right', 'undo-2', 'copy', 'x', 'redo-2', 'highlighter', 'palette', 'pencil', 'slash', 'square', 'circle', 'ellipse', 'type', 'a-large-small'] for name in names: svg = (root / f'{name}.svg').read_text(encoding='utf-8') for variant, color in [('normal', '#334155'), ('active', '#2563eb'), ('disabled', '#94a3b8')]: png = resvg_py.svg_to_bytes(svg_string=svg.replace('currentColor', color), width=256, height=256) im = Image.open(BytesIO(png)).convert('RGBA') im.save(root / f'{name}-{variant}.ico', sizes=[(s, s) for s in (16,20,22,24,28,32,40,44,48,56,64,96,128,256)]) # Small local visual QA sheet of the actual downloaded paths. preview = Image.new('RGB', (len(names)*60, 72), '#f8fafc') for i, name in enumerate(names): icon = Image.open(root / f'{name}-normal.ico').convert('RGBA').resize((32,32),Image.Resampling.LANCZOS) preview.paste(icon,(14+i*60,20),icon) preview.save(root / 'preview.png') # Cursor uses the same Lucide pencil, with a white outline for dark screenshots. paths = '\n'.join(re.findall(r']+/>', (root / 'pencil.svg').read_text(encoding='utf-8'))) cursor_svg = f''' {paths}{paths}''' cursor_png = resvg_py.svg_to_bytes(svg_string=cursor_svg, width=256, height=256) cursor_image = Image.open(BytesIO(cursor_png)).convert('RGBA') buffer = BytesIO() cursor_image.save(buffer, format='ICO', bitmap_format='bmp', sizes=[(s,s) for s in (32,48,64,96)]) cursor = bytearray(buffer.getvalue()) struct.pack_into('