43 lines
1.3 KiB
Python
43 lines
1.3 KiB
Python
import os
|
|
from PIL import Image, ImageDraw
|
|
|
|
os.makedirs('build/icons', exist_ok=True)
|
|
|
|
size = (512, 512)
|
|
img = Image.new('RGBA', size, (0, 0, 0, 0))
|
|
draw = ImageDraw.Draw(img)
|
|
|
|
# 1. 绘制带有圆角的深色背景外框 (Tokyo Night 磨砂质感)
|
|
# 圆角矩形
|
|
draw.rounded_rectangle([(16, 16), (496, 496)], radius=100, fill=(26, 27, 38, 255), outline=(122, 162, 247, 180), width=6)
|
|
|
|
# 2. 内部顶部标题栏装饰小圆点 (macOS / Linux 风格微缩)
|
|
draw.ellipse([(60, 60), (76, 76)], fill=(247, 118, 142, 255)) # 红
|
|
draw.ellipse([(92, 60), (108, 76)], fill=(224, 175, 104, 255)) # 黄
|
|
draw.ellipse([(124, 60), (140, 76)], fill=(158, 206, 106, 255)) # 绿
|
|
|
|
# 3. 绘制终端提示符 > (青色发光)
|
|
points = [
|
|
(110, 180),
|
|
(240, 290),
|
|
(110, 400),
|
|
(150, 400),
|
|
(280, 290),
|
|
(150, 180),
|
|
]
|
|
draw.polygon(points, fill=(125, 207, 255, 255))
|
|
|
|
# 4. 绘制光标下划线 _ (品红霓虹)
|
|
draw.rectangle([(300, 360), (410, 395)], fill=(187, 154, 247, 255))
|
|
|
|
# 保存 512x512 图标
|
|
img.save('build/icon.png', 'PNG')
|
|
img.save('build/icons/512x512.png', 'PNG')
|
|
|
|
# 同时也生成常见的 256x256, 128x128, 64x64, 32x32 备用
|
|
for s in [256, 128, 64, 32]:
|
|
resized = img.resize((s, s), Image.Resampling.LANCZOS)
|
|
resized.save(f'build/icons/{s}x{s}.png', 'PNG')
|
|
|
|
print('App icons generated successfully!')
|