diff options
Diffstat (limited to 'tools/make-icons.ps1')
| -rw-r--r-- | tools/make-icons.ps1 | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tools/make-icons.ps1 b/tools/make-icons.ps1 new file mode 100644 index 0000000..6c6f134 --- /dev/null +++ b/tools/make-icons.ps1 @@ -0,0 +1,43 @@ +# Generates PNG icons from an inline SVG without external dependencies. +# Uses Google's svg2png-free approach: renders via WPF/WinForms is complex, +# so this script draws a simple vector-style icon with System.Drawing. +# No Node.js, no npm, no third-party libraries. + +Add-Type -AssemblyName System.Drawing + +$size48 = 48 +$size96 = 96 + +function New-Icon([int]$size, [string]$path) { + $bmp = New-Object System.Drawing.Bitmap($size, $size) + $g = [System.Drawing.Graphics]::FromImage($bmp) + $g.SmoothingMode = [System.Drawing.Drawing2D.SmoothingMode]::AntiAlias + + # Background: rounded rect (drawn as filled ellipse-ish square) + $bgBrush = New-Object System.Drawing.SolidBrush ([System.Drawing.Color]::FromArgb(255, 26, 115, 232)) + $g.FillEllipse($bgBrush, 1, 1, $size - 2, $size - 2) + + # Translate glyph: "文A" style - draw a stylized "A" and lines + $white = [System.Drawing.Brushes]::White + $font = New-Object System.Drawing.Font ('Segoe UI', [float]($size * 0.42), [System.Drawing.FontStyle]::Bold) + $sf = New-Object System.Drawing.StringFormat + $sf.Alignment = [System.Drawing.StringAlignment]::Center + $sf.LineAlignment = [System.Drawing.StringAlignment]::Center + $rect = New-Object System.Drawing.RectangleF (0, ($size * 0.08), $size, ($size * 0.8)) + $g.DrawString('A', $font, [System.Drawing.Brushes]::White, $rect, $sf) + + # Small underline bar + $pen = New-Object System.Drawing.Pen ([System.Drawing.Color]::White) + $pen.Width = [float]($size * 0.07) + $g.DrawLine($pen, [float]($size * 0.25), [float]($size * 0.78), [float]($size * 0.75), [float]($size * 0.8)) + $pen.Dispose() + + $g.Dispose() + $bmp.Save($path, [System.Drawing.Imaging.ImageFormat]::Png) + $g.Dispose() + $bmp.Dispose() + Write-Host "Created $path" +} + +New-Icon $size48 "icons\icon-48.png" +New-Icon ($size48 * 2) "icons\icon-96.png"
\ No newline at end of file |
