Skip to content

Commit 76df7f7

Browse files
committed
feat(icons): add complete icon assets for all platforms
- Add quick_icon.sh script for rapid icon generation without ImageMagick - Update create_icon.sh to use magick command and improve emoji handling - Add complete set of Windows Store logo icons (Square sizes) - Add complete set of Android launcher icons for all densities (mdpi, hdpi, xhdpi, xxhdpi, xxxhdpi) - Add complete set of iOS AppIcon assets for all required sizes and scales - Add macOS icon files (icon.icns) and Windows icon file (icon.ico) - Update base icon.png and 32x32.png with new design - Add 64x64.png and 128x128@2x.png for additional resolution support - Improve icon generation workflow with Python-based PIL approach for better cross-platform compatibility - Support emoji, gradient, and solid color icon options with fallback mechanisms
1 parent c840722 commit 76df7f7

54 files changed

Lines changed: 152 additions & 32 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

scripts/create_icon.sh

Lines changed: 24 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -38,36 +38,23 @@ echo ""
3838
read -p "请输入选项 (1-5): " choice
3939

4040
case $choice in
41-
1)
42-
echo "创建 📝 笔记本图标..."
43-
convert -size 1024x1024 xc:none \
44-
-gravity center \
45-
-pointsize 800 \
46-
-font "Apple-Color-Emoji" \
47-
-annotate +0+0 "📝" \
48-
"$TEMP_DIR/icon-1024.png"
49-
;;
50-
2)
51-
echo "创建 ✏️ 铅笔图标..."
52-
convert -size 1024x1024 xc:none \
53-
-gravity center \
54-
-pointsize 800 \
55-
-font "Apple-Color-Emoji" \
56-
-annotate +0+0 "✏️" \
57-
"$TEMP_DIR/icon-1024.png"
58-
;;
59-
3)
60-
echo "创建 📄 文档图标..."
61-
convert -size 1024x1024 xc:none \
62-
-gravity center \
63-
-pointsize 800 \
64-
-font "Apple-Color-Emoji" \
65-
-annotate +0+0 "📄" \
66-
"$TEMP_DIR/icon-1024.png"
41+
1|2|3)
42+
# Emoji 图标需要特殊处理,使用 sips 和截图
43+
echo "⚠️ Emoji 图标需要手动创建"
44+
echo ""
45+
echo "请按照以下步骤操作:"
46+
echo "1. 打开预览 (Preview.app)"
47+
echo "2. 文件 > 新建 > 从剪贴板"
48+
echo "3. 复制这个 emoji: 📝"
49+
echo "4. 调整大小到 1024x1024"
50+
echo "5. 保存为 icon-1024.png"
51+
echo ""
52+
echo "或者选择选项 4 或 5 使用纯色图标"
53+
exit 0
6754
;;
6855
4)
69-
echo "创建紫色渐变圆形图标..."
70-
convert -size 1024x1024 xc:none \
56+
echo "创建紫色圆形图标..."
57+
magick -size 1024x1024 xc:none \
7158
-fill "rgb(102,126,234)" \
7259
-draw "circle 512,512 512,100" \
7360
-fill white \
@@ -78,10 +65,15 @@ case $choice in
7865
"$TEMP_DIR/icon-1024.png"
7966
;;
8067
5)
81-
echo "创建字母 N 图标..."
82-
convert -size 1024x1024 \
83-
-define gradient:angle=135 \
68+
echo "创建字母 N 渐变图标..."
69+
# 创建渐变背景
70+
magick -size 1024x1024 \
8471
gradient:"rgb(102,126,234)-rgb(118,75,162)" \
72+
-distort SRT 45 \
73+
"$TEMP_DIR/gradient.png"
74+
75+
# 添加文字
76+
magick "$TEMP_DIR/gradient.png" \
8577
-fill white \
8678
-pointsize 700 \
8779
-font "Helvetica-Bold" \
@@ -97,7 +89,7 @@ esac
9789

9890
# 添加圆角(macOS 风格)
9991
echo "✨ 添加圆角..."
100-
convert "$TEMP_DIR/icon-1024.png" \
92+
magick "$TEMP_DIR/icon-1024.png" \
10193
\( +clone -alpha extract \
10294
-draw 'fill black polygon 0,0 0,150 150,0 fill white circle 150,150 150,0' \
10395
\( +clone -flip \) -compose Multiply -composite \

scripts/quick_icon.sh

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
#!/bin/bash
2+
3+
# 快速创建 QuickNote 图标(不需要 ImageMagick)
4+
5+
set -e
6+
7+
echo "🎨 快速创建 QuickNote 图标"
8+
echo ""
9+
10+
# 检查是否安装了 sips(macOS 自带)
11+
if ! command -v sips &> /dev/null; then
12+
echo "❌ 错误: sips 命令不可用"
13+
exit 1
14+
fi
15+
16+
# 创建临时目录
17+
TEMP_DIR=$(mktemp -d)
18+
ICON_DIR="src-tauri/icons"
19+
20+
mkdir -p "$ICON_DIR"
21+
22+
echo "📝 创建基础图标..."
23+
24+
# 使用 Python 创建一个简单的 PNG 图标
25+
python3 << 'PYTHON_SCRIPT'
26+
from PIL import Image, ImageDraw, ImageFont
27+
import os
28+
29+
# 创建 1024x1024 的图像
30+
size = 1024
31+
img = Image.new('RGBA', (size, size), (0, 0, 0, 0))
32+
draw = ImageDraw.Draw(img)
33+
34+
# 绘制紫色渐变圆形
35+
for i in range(size):
36+
for j in range(size):
37+
dx = i - size/2
38+
dy = j - size/2
39+
distance = (dx*dx + dy*dy) ** 0.5
40+
41+
if distance < size/2 - 50:
42+
# 渐变色
43+
ratio = distance / (size/2)
44+
r = int(102 + (118-102) * ratio)
45+
g = int(126 + (75-126) * ratio)
46+
b = int(234 + (162-234) * ratio)
47+
img.putpixel((i, j), (r, g, b, 255))
48+
49+
# 绘制白色字母 N
50+
try:
51+
font = ImageFont.truetype("/System/Library/Fonts/Helvetica.ttc", 700)
52+
except:
53+
font = ImageFont.load_default()
54+
55+
text = "N"
56+
bbox = draw.textbbox((0, 0), text, font=font)
57+
text_width = bbox[2] - bbox[0]
58+
text_height = bbox[3] - bbox[1]
59+
x = (size - text_width) / 2 - bbox[0]
60+
y = (size - text_height) / 2 - bbox[1]
61+
62+
draw.text((x, y), text, fill=(255, 255, 255, 255), font=font)
63+
64+
# 保存
65+
img.save('icon-1024.png')
66+
print("✅ 图标创建成功: icon-1024.png")
67+
PYTHON_SCRIPT
68+
69+
if [ ! -f "icon-1024.png" ]; then
70+
echo "❌ Python 脚本失败,尝试备用方案..."
71+
72+
# 备用方案:创建纯色图标
73+
cat > "$TEMP_DIR/create_icon.py" << 'EOF'
74+
from PIL import Image, ImageDraw
75+
img = Image.new('RGBA', (1024, 1024), (102, 126, 234, 255))
76+
draw = ImageDraw.Draw(img)
77+
draw.ellipse([100, 100, 924, 924], fill=(118, 75, 162, 255))
78+
img.save('icon-1024.png')
79+
EOF
80+
python3 "$TEMP_DIR/create_icon.py"
81+
fi
82+
83+
# 使用 sips 生成不同尺寸
84+
echo "🔧 生成不同尺寸..."
85+
86+
sips -z 32 32 icon-1024.png --out "$ICON_DIR/32x32.png" > /dev/null
87+
sips -z 128 128 icon-1024.png --out "$ICON_DIR/128x128.png" > /dev/null
88+
sips -z 256 256 icon-1024.png --out "$ICON_DIR/128x128@2x.png" > /dev/null
89+
sips -z 256 256 icon-1024.png --out "$ICON_DIR/icon.png" > /dev/null
90+
91+
# 创建 .icns 文件(macOS 图标)
92+
echo "🍎 创建 macOS 图标..."
93+
ICONSET_DIR="$TEMP_DIR/icon.iconset"
94+
mkdir -p "$ICONSET_DIR"
95+
96+
sips -z 16 16 icon-1024.png --out "$ICONSET_DIR/icon_16x16.png" > /dev/null
97+
sips -z 32 32 icon-1024.png --out "$ICONSET_DIR/icon_16x16@2x.png" > /dev/null
98+
sips -z 32 32 icon-1024.png --out "$ICONSET_DIR/icon_32x32.png" > /dev/null
99+
sips -z 64 64 icon-1024.png --out "$ICONSET_DIR/icon_32x32@2x.png" > /dev/null
100+
sips -z 128 128 icon-1024.png --out "$ICONSET_DIR/icon_128x128.png" > /dev/null
101+
sips -z 256 256 icon-1024.png --out "$ICONSET_DIR/icon_128x128@2x.png" > /dev/null
102+
sips -z 256 256 icon-1024.png --out "$ICONSET_DIR/icon_256x256.png" > /dev/null
103+
sips -z 512 512 icon-1024.png --out "$ICONSET_DIR/icon_256x256@2x.png" > /dev/null
104+
sips -z 512 512 icon-1024.png --out "$ICONSET_DIR/icon_512x512.png" > /dev/null
105+
sips -z 1024 1024 icon-1024.png --out "$ICONSET_DIR/icon_512x512@2x.png" > /dev/null
106+
107+
iconutil -c icns "$ICONSET_DIR" -o "$ICON_DIR/icon.icns"
108+
109+
# 清理
110+
rm -rf "$TEMP_DIR" icon-1024.png
111+
112+
echo ""
113+
echo "✅ 图标生成完成!"
114+
echo "📁 图标位置: $ICON_DIR/"
115+
echo ""
116+
echo "生成的文件:"
117+
ls -lh "$ICON_DIR/"
118+
echo ""
119+
echo "💡 提示: 运行 'cargo tauri build' 重新构建应用以应用新图标"

src-tauri/icons/128x128.png

5.61 KB

src-tauri/icons/128x128@2x.png

11.3 KB

src-tauri/icons/32x32.png

-1.65 KB

src-tauri/icons/64x64.png

2.48 KB
4.5 KB
6.24 KB
6.61 KB
12.4 KB

0 commit comments

Comments
 (0)