#!/bin/bash # setup-icons.sh - 生成 tabBar 占位图标 # 在 frontend 目录下运行: bash setup-icons.sh STATIC_DIR="static" mkdir -p "$STATIC_DIR" # 颜色:灰色=#999999,绿色=#07c160 python3 << 'PYEOF' import struct, zlib def make_png(filename, r, g, b): def chunk(chunk_type, data): c = chunk_type + data return struct.pack('>I', len(data)) + c + struct.pack('>I', zlib.crc32(c) & 0xffffffff) sig = b'\x89PNG\r\n\x1a\n' ihdr = chunk(b'IHDR', struct.pack('>IIBBBBB', 81, 81, 8, 2, 0, 0, 0)) raw = b'' for y in range(81): raw += b'\x00' for x in range(81): raw += bytes([r, g, b]) idat = chunk(b'IDAT', zlib.compress(raw)) iend = chunk(b'IEND', b'') with open(filename, 'wb') as f: f.write(sig + ihdr + idat + iend) print(f'Created {filename}') icons = [ ('static/tab-home.png', 153, 153, 153), ('static/tab-home-active.png', 7, 193, 96), ('static/tab-report.png', 153, 153, 153), ('static/tab-report-active.png', 7, 193, 96), ('static/tab-mine.png', 153, 153, 153), ('static/tab-mine-active.png', 7, 193, 96), ] for fn, r, g, b in icons: make_png(fn, r, g, b) print('All icons created!') PYEOF