All checks were successful
Verify and publish Calio container / build-and-push (push) Successful in 28s
26 lines
1.8 KiB
PowerShell
26 lines
1.8 KiB
PowerShell
Add-Type -AssemblyName System.Drawing
|
|
$iconRoot = Join-Path $PSScriptRoot '../public/icons'
|
|
New-Item -ItemType Directory -Force -Path $iconRoot | Out-Null
|
|
foreach ($iconSpec in @(@('icon-192.png',192), @('icon-512.png',512), @('maskable-512.png',512), @('apple-touch-icon.png',180), @('apple-touch-icon-v2.png',180))) {
|
|
$iconSize = [int]$iconSpec[1]
|
|
$bitmap = New-Object System.Drawing.Bitmap($iconSize,$iconSize)
|
|
$graphics = [System.Drawing.Graphics]::FromImage($bitmap)
|
|
$graphics.SmoothingMode = [System.Drawing.Drawing2D.SmoothingMode]::AntiAlias
|
|
$graphics.ScaleTransform($iconSize / 192.0, $iconSize / 192.0)
|
|
$isAppleIcon = $iconSpec[0].StartsWith('apple-touch-icon')
|
|
$backgroundColor = if ($isAppleIcon) { '#121318' } else { '#8391ed' }
|
|
$glyphColor = if ($isAppleIcon) { '#f4f4f8' } else { '#f5f5ef' }
|
|
$leafColor = if ($isAppleIcon) { '#f4f4f8' } else { '#cad1ff' }
|
|
$graphics.Clear([System.Drawing.ColorTranslator]::FromHtml($backgroundColor))
|
|
$cream = New-Object System.Drawing.SolidBrush([System.Drawing.ColorTranslator]::FromHtml($glyphColor))
|
|
$ringPen = New-Object System.Drawing.Pen($cream,8)
|
|
$graphics.DrawEllipse($ringPen,48,54,96,96)
|
|
foreach ($point in @(@(72,112),@(95,122),@(118,112),@(96,99))) { $graphics.FillEllipse($cream,($point[0]-8),($point[1]-8),16,16) }
|
|
$leaf = New-Object System.Drawing.Drawing2D.GraphicsPath
|
|
$leaf.AddBezier(96,50,94,27,119,26,120,27)
|
|
$leaf.AddBezier(120,27,120,44,105,51,96,50)
|
|
$green = New-Object System.Drawing.SolidBrush([System.Drawing.ColorTranslator]::FromHtml($leafColor))
|
|
$graphics.FillPath($green,$leaf)
|
|
$bitmap.Save((Join-Path $iconRoot $iconSpec[0]),[System.Drawing.Imaging.ImageFormat]::Png)
|
|
$graphics.Dispose(); $bitmap.Dispose(); $cream.Dispose(); $ringPen.Dispose(); $leaf.Dispose(); $green.Dispose()
|
|
}
|