29 lines
1.3 KiB
PowerShell
29 lines
1.3 KiB
PowerShell
$ErrorActionPreference = "Stop"
|
|
Add-Type -AssemblyName System.Drawing
|
|
|
|
function New-HanIcon([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
|
|
$g.TextRenderingHint = [System.Drawing.Text.TextRenderingHint]::AntiAliasGridFit
|
|
$g.Clear([System.Drawing.Color]::FromArgb(255, 3, 2, 19))
|
|
$fontSize = [math]::Max(8, [math]::Floor($size * 0.22))
|
|
$font = New-Object System.Drawing.Font("Segoe UI", $fontSize, [System.Drawing.FontStyle]::Bold)
|
|
$brush = New-Object System.Drawing.SolidBrush([System.Drawing.Color]::White)
|
|
$format = New-Object System.Drawing.StringFormat
|
|
$format.Alignment = "Center"
|
|
$format.LineAlignment = "Center"
|
|
$rect = New-Object System.Drawing.RectangleF 0, 0, $size, $size
|
|
$g.DrawString("HAN", $font, $brush, $rect, $format)
|
|
$g.Dispose()
|
|
$bmp.Save($path, [System.Drawing.Imaging.ImageFormat]::Png)
|
|
$bmp.Dispose()
|
|
}
|
|
|
|
$publicDir = Join-Path $PSScriptRoot ".." "public"
|
|
New-Item -ItemType Directory -Force -Path $publicDir | Out-Null
|
|
New-HanIcon 512 (Join-Path $publicDir "icon-512.png")
|
|
New-HanIcon 192 (Join-Path $publicDir "icon-192.png")
|
|
New-HanIcon 180 (Join-Path $publicDir "apple-touch-icon.png")
|
|
New-HanIcon 32 (Join-Path $publicDir "favicon.png")
|