Files
FunConnect/scripts/generate-icons.ps1

44 lines
1.5 KiB
PowerShell

# FunMC 图标生成脚本 (Windows)
# 需要安装 ImageMagick 或使用 cargo tauri icon 命令
$ErrorActionPreference = "Stop"
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
$RootDir = Split-Path -Parent $ScriptDir
$IconsDir = "$RootDir\client\icons"
$SvgPath = "$IconsDir\icon.svg"
Write-Host "FunMC 图标生成脚本" -ForegroundColor Yellow
Write-Host "===================" -ForegroundColor Yellow
# 检查 SVG 源文件
if (-not (Test-Path $SvgPath)) {
Write-Host "错误: 未找到 SVG 源文件: $SvgPath" -ForegroundColor Red
exit 1
}
# 方法 1: 使用 cargo tauri icon (推荐)
Write-Host "`n尝试使用 cargo tauri icon..." -ForegroundColor Cyan
Push-Location "$RootDir\client"
try {
cargo tauri icon $SvgPath
Write-Host "图标生成成功!" -ForegroundColor Green
}
catch {
Write-Host "cargo tauri icon 失败,请手动生成图标" -ForegroundColor Yellow
Write-Host "`n手动生成步骤:" -ForegroundColor White
Write-Host "1. 安装 ImageMagick: https://imagemagick.org/script/download.php"
Write-Host "2. 或使用在线工具: https://realfavicongenerator.net/"
Write-Host "3. 或使用 Figma/Photoshop 导出以下尺寸的 PNG:"
Write-Host " - 32x32.png"
Write-Host " - 128x128.png"
Write-Host " - 128x128@2x.png (256x256)"
Write-Host " - icon.ico (Windows)"
Write-Host " - icon.icns (macOS)"
}
finally {
Pop-Location
}
Write-Host "`n图标目录: $IconsDir" -ForegroundColor Cyan