import struct, zlib, os def make_png(path, size): w = h = size raw = b'' for y in range(h): row = b'\x00' for x in range(w): cx, cy = x - w / 2, y - h / 2 d = (cx * cx + cy * cy) ** 0.5 / (w / 2) r = int(120 + 60 * (1 - d)) g = int(60 + 40 * (1 - d)) b = int(200 + 40 * (1 - d)) row += bytes((r, g, b, 255)) raw += row def chunk(tag, data): c = tag + data return struct.pack('>I', len(data)) + c + struct.pack('>I', zlib.crc32(c) % 0x100000000) png = b'\x89PNG\r\n\x1a\n' png += chunk(b'IHDR', struct.pack('>IIBBBBB', w, h, 8, 6, 0, 0, 0)) png += chunk(b'IDAT', zlib.compress(raw, 9)) png += chunk(b'IEND', b'') open(path, 'wb').write(png) os.makedirs('src-tauri/icons', exist_ok=True) make_png('src-tauri/icons/32x32.png', 32) make_png('src-tauri/icons/128x128.png', 128) png128 = open('src-tauri/icons/128x128.png', 'rb').read() ico = struct.pack('