iptv-app/desktop/create-icons.sh
2026-02-04 18:02:52 +08:00

40 lines
1.6 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# 创建简单的默认图标
ICONS_DIR="src-tauri/icons"
# 使用ImageMagick创建简单图标如果可用
if command -v convert &> /dev/null; then
convert -size 512x512 xc: '#1a1a1a' "$ICONS_DIR/icon.png"
convert "$ICONS_DIR/icon.png" -resize 32x32 "$ICONS_DIR/32x32.png"
convert "$ICONS_DIR/icon.png" -resize 128x128 "$ICONS_DIR/128x128.png"
convert "$ICONS_DIR/icon.png" -resize 256x256 "$ICONS_DIR/128x128@2x.png"
cp "$ICONS_DIR/icon.png" "$ICONS_DIR/icon.ico"
# 添加文字
convert -size 512x512 xc: '#00d4ff' -pointsize 200 -fill white -gravity center -annotate +0+0 "IPTV" "$ICONS_DIR/icon.png"
convert "$ICONS_DIR/icon.png" "$ICONS_DIR/icon.ico"
# Mac icns
if command -v iconutil &> /dev/null; then
mkdir -p "$ICONS_DIR/icon.iconset"
for size in 16 32 64 128 256 512; do
convert "$ICONS_DIR/icon.png" -resize ${size}x${size} "$ICONS_DIR/icon.iconset/icon_${size}x${size}.png"
convert "$ICONS_DIR/icon.png" -resize $((size*2))x$((size*2)) "$ICONS_DIR/icon.iconset/icon_${size}x${size}@2x.png"
done
iconutil -c icns "$ICONS_DIR/icon.iconset" -o "$ICONS_DIR/icon.icns"
rm -rf "$ICONS_DIR/icon.iconset"
else
cp "$ICONS_DIR/icon.png" "$ICONS_DIR/icon.icns"
fi
else
# 没有ImageMagick创建空白文件作为占位
touch "$ICONS_DIR/32x32.png"
touch "$ICONS_DIR/128x128.png"
touch "$ICONS_DIR/128x128@2x.png"
touch "$ICONS_DIR/icon.icns"
touch "$ICONS_DIR/icon.ico"
echo "警告: 未找到 ImageMagick使用了空白图标文件"
fi
echo "图标创建完成"