|
|
|
|
@ -197,11 +197,7 @@ ensure_tauri_icons() {
|
|
|
|
|
local icons_dir="$REPO_ROOT/$project_dir/src-tauri/icons"
|
|
|
|
|
mkdir -p "$icons_dir"
|
|
|
|
|
|
|
|
|
|
if [[ -f "$icons_dir/32x32.png" && -f "$icons_dir/128x128.png" && -f "$icons_dir/256x256.png" ]]; then
|
|
|
|
|
return 0
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
echo "==> [$project_dir] 生成默认图标资源(32/128/256)"
|
|
|
|
|
echo "==> [$project_dir] 生成默认图标资源(RGBA: 32/128/256)"
|
|
|
|
|
python3 - "$icons_dir" "$project_dir" <<'PY'
|
|
|
|
|
import binascii
|
|
|
|
|
import os
|
|
|
|
|
@ -213,9 +209,9 @@ icons_dir = sys.argv[1]
|
|
|
|
|
project_name = sys.argv[2]
|
|
|
|
|
|
|
|
|
|
if "broadcast" in project_name:
|
|
|
|
|
color = (16, 185, 129) # green
|
|
|
|
|
color = (16, 185, 129, 255) # green
|
|
|
|
|
else:
|
|
|
|
|
color = (37, 99, 235) # blue
|
|
|
|
|
color = (37, 99, 235, 255) # blue
|
|
|
|
|
|
|
|
|
|
def png_chunk(tag: bytes, data: bytes) -> bytes:
|
|
|
|
|
return (
|
|
|
|
|
@ -225,10 +221,10 @@ def png_chunk(tag: bytes, data: bytes) -> bytes:
|
|
|
|
|
+ struct.pack("!I", binascii.crc32(tag + data) & 0xFFFFFFFF)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
def write_png(path: str, size: int, rgb: tuple[int, int, int]) -> None:
|
|
|
|
|
row = bytes(rgb) * size
|
|
|
|
|
def write_png(path: str, size: int, rgba: tuple[int, int, int, int]) -> None:
|
|
|
|
|
row = bytes(rgba) * size
|
|
|
|
|
raw = b"".join(b"\x00" + row for _ in range(size))
|
|
|
|
|
ihdr = struct.pack("!IIBBBBB", size, size, 8, 2, 0, 0, 0)
|
|
|
|
|
ihdr = struct.pack("!IIBBBBB", size, size, 8, 6, 0, 0, 0)
|
|
|
|
|
idat = zlib.compress(raw, 9)
|
|
|
|
|
png = (
|
|
|
|
|
b"\x89PNG\r\n\x1a\n"
|
|
|
|
|
|