Skip to content

Commit 895a468

Browse files
authored
Merge pull request #143 from KamilDev/refresh-app-icon
Refresh the app icon and README banner to match the Fluent UI
2 parents 13536f2 + d377c82 commit 895a468

10 files changed

Lines changed: 301 additions & 4 deletions

File tree

79.5 KB
Binary file not shown.
Lines changed: 54 additions & 0 deletions
Loading
-27.5 KB
Loading

Logo/Logo-en.png

67.6 KB
Loading

Logo/Logo-en.svg

Lines changed: 78 additions & 0 deletions
Loading

Logo/Logo.png

-5.79 KB
Loading

Logo/Logo.svg

Lines changed: 78 additions & 0 deletions
Loading

README-en.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
**[简体中文](README.md)** | **English**
22

33
<div align="center">
4-
<img width="700" src="/Logo/Logo.png"></img>
4+
<img width="700" src="./Logo/Logo-en.png"></img>
55
</div>
66
<h1 align="center">ContextMenuManager</h1>
77
<h4 align="center">A program to manage the Windows right-click context menu with support of Windows 7 - 11</h4>
@@ -19,7 +19,7 @@
1919

2020
## 💕 Thanks
2121
* This project is based on [https://github.com/BluePointLilac/ContextMenuManager](https://github.com/BluePointLilac/ContextMenuManager), thanks to [蓝点lilac](https://github.com/BluePointLilac)!
22-
* Thanks to [澜芸](https://github.com/LanYun2022) for new icons!
22+
* Thanks to [澜芸](https://github.com/LanYun2022) and [KamilDev](https://github.com/KamilDev) for new icons!
2323

2424
## 🚀 Download
2525
* [Latest Version][Latest]<br>

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
**简体中文** | **[English](README-en.md)**
22

33
<div align="center">
4-
<img width="700" src="/Logo/Logo.png"></img>
4+
<img width="700" src="./Logo/Logo.png"></img>
55
</div>
66
<h1 align="center">ContextMenuManager</h1>
77
<h4 align="center">一个纯粹的Windows右键菜单管理器,支持 Windows 7 ~ 11</h4>
@@ -19,7 +19,7 @@
1919

2020
## 💕 特别感谢
2121
* 本项目基于 [https://github.com/BluePointLilac/ContextMenuManager](https://github.com/BluePointLilac/ContextMenuManager) 进行开发,感谢作者 [蓝点lilac](https://github.com/BluePointLilac)
22-
* 感谢由 [澜芸](https://github.com/LanYun2022) 制作的的新图标!
22+
* 感谢由 [澜芸](https://github.com/LanYun2022) [KamilDev](https://github.com/KamilDev) 制作的的新图标!
2323

2424
## 🚀 程序下载
2525
* [最新版本][Latest]<br>

generate-icons.ps1

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
#Requires -Version 7.0
2+
$ErrorActionPreference = 'Stop'
3+
4+
$root = $PSScriptRoot
5+
$appSvg = Join-Path $root 'ContextMenuManager\Properties\AppIcon.svg'
6+
$propsDir = Join-Path $root 'ContextMenuManager\Properties'
7+
$ico = Join-Path $propsDir 'AppIcon.ico'
8+
$logoPng = Join-Path $propsDir 'Resources\Images\Logo.png'
9+
10+
$missing = @()
11+
if (-not (Get-Command resvg -ErrorAction SilentlyContinue)) { $missing += 'resvg' }
12+
if (-not (Get-Command magick -ErrorAction SilentlyContinue)) { $missing += 'magick' }
13+
if ($missing.Count) {
14+
Write-Host "Missing required tool(s): $($missing -join ', ')" -ForegroundColor Red
15+
if ($missing -contains 'resvg') {
16+
Write-Host "Install resvg: https://github.com/linebender/resvg/releases (or: cargo install resvg)" -ForegroundColor Yellow
17+
}
18+
if ($missing -contains 'magick') {
19+
Write-Host "Install ImageMagick: https://imagemagick.org/script/download.php#windows (or: winget install ImageMagick.ImageMagick)" -ForegroundColor Yellow
20+
}
21+
exit 1
22+
}
23+
24+
if (-not (Test-Path $appSvg)) {
25+
Write-Host "SVG not found: $appSvg" -ForegroundColor Red
26+
exit 1
27+
}
28+
29+
$icoSizes = 16, 20, 24, 32, 40, 48, 64, 96, 128, 256
30+
$tempPngs = foreach ($s in $icoSizes) { Join-Path $propsDir "icon_$s.png" }
31+
32+
$iconTasks = @()
33+
for ($i = 0; $i -lt $icoSizes.Count; $i++) {
34+
$iconTasks += [pscustomobject]@{ Size = $icoSizes[$i]; Output = $tempPngs[$i] }
35+
}
36+
$iconTasks += [pscustomobject]@{ Size = 256; Output = $logoPng }
37+
38+
Write-Host "=== Rasterizing app icon (parallel) ==="
39+
$iconTasks | ForEach-Object -ThrottleLimit 16 -Parallel {
40+
$ErrorActionPreference = 'Stop'
41+
$t = $_
42+
& resvg $using:appSvg $t.Output -w $t.Size -h $t.Size
43+
if ($LASTEXITCODE -ne 0) { throw "resvg failed for $($t.Output)" }
44+
}
45+
46+
Write-Host "=== Packing AppIcon.ico ==="
47+
& magick @tempPngs -define png:exclude-chunks=date,time $ico
48+
if ($LASTEXITCODE -ne 0) {
49+
Write-Host "magick failed to pack AppIcon.ico." -ForegroundColor Red
50+
exit 1
51+
}
52+
$tempPngs | Where-Object { Test-Path $_ } | Remove-Item
53+
54+
$bannerTasks = @(
55+
[pscustomobject]@{ Svg = (Join-Path $root 'Logo\Logo.svg'); Png = (Join-Path $root 'Logo\Logo.png') }
56+
[pscustomobject]@{ Svg = (Join-Path $root 'Logo\Logo-en.svg'); Png = (Join-Path $root 'Logo\Logo-en.png') }
57+
)
58+
59+
Write-Host "=== Rasterizing + trimming logo banners (parallel) ==="
60+
$trimmed = $bannerTasks | ForEach-Object -ThrottleLimit 4 -Parallel {
61+
$ErrorActionPreference = 'Stop'
62+
$t = $_
63+
if (-not (Test-Path $t.Svg)) { throw "SVG not found: $($t.Svg)" }
64+
$tmp = "$($t.Png).tmp.png"
65+
& resvg $t.Svg $tmp -h 512
66+
if ($LASTEXITCODE -ne 0) { throw "resvg failed for $($t.Svg)" }
67+
& magick $tmp -trim +repage $tmp
68+
if ($LASTEXITCODE -ne 0) { throw "magick trim failed for $tmp" }
69+
$wh = (& magick identify -format "%w %h" $tmp).Trim() -split ' '
70+
[pscustomobject]@{ Png = $t.Png; Tmp = $tmp; W = [int]$wh[0]; H = [int]$wh[1] }
71+
}
72+
73+
$maxW = ($trimmed | Measure-Object -Property W -Maximum).Maximum
74+
$maxH = ($trimmed | Measure-Object -Property H -Maximum).Maximum
75+
Write-Host "Normalizing banners to ${maxW}x${maxH}"
76+
77+
$trimmed | ForEach-Object -ThrottleLimit 4 -Parallel {
78+
$ErrorActionPreference = 'Stop'
79+
$d = $_
80+
& magick $d.Tmp -background none -gravity center `
81+
-extent "$($using:maxW)x$($using:maxH)" +repage `
82+
-define png:exclude-chunks=date,time $d.Png
83+
if ($LASTEXITCODE -ne 0) { throw "magick extent failed for $($d.Png)" }
84+
Remove-Item $d.Tmp
85+
}
86+
87+
Write-Host "=== Done ==="

0 commit comments

Comments
 (0)