[CmdletBinding()] param( [string]$OutputPath = ".\assets\MrTrust.ico" ) $ErrorActionPreference = "Stop" function Resolve-FullPath { param([Parameter(Mandatory)][string]$Path) $executionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($Path) } Add-Type -AssemblyName System.Drawing $resolvedOutputPath = Resolve-FullPath $OutputPath $outputDirectory = Split-Path -Parent $resolvedOutputPath New-Item -ItemType Directory -Force -Path $outputDirectory | Out-Null $bitmap = [Drawing.Bitmap]::new(64, 64) $graphics = [Drawing.Graphics]::FromImage($bitmap) $graphics.SmoothingMode = [Drawing.Drawing2D.SmoothingMode]::AntiAlias $graphics.Clear([Drawing.Color]::Transparent) $backgroundBrush = [Drawing.SolidBrush]::new([Drawing.Color]::FromArgb(27, 32, 35)) $accentBrush = [Drawing.SolidBrush]::new([Drawing.Color]::FromArgb(28, 185, 111)) $lightBrush = [Drawing.SolidBrush]::new([Drawing.Color]::FromArgb(225, 231, 227)) $shadowBrush = [Drawing.SolidBrush]::new([Drawing.Color]::FromArgb(70, 0, 0, 0)) $outlinePen = [Drawing.Pen]::new([Drawing.Color]::FromArgb(71, 84, 90), 3) $graphics.FillRectangle($shadowBrush, 9, 10, 48, 48) $graphics.FillRectangle($backgroundBrush, 7, 7, 48, 48) $graphics.DrawRectangle($outlinePen, 7, 7, 48, 48) $graphics.FillRectangle($accentBrush, 13, 13, 12, 36) $graphics.FillRectangle($accentBrush, 13, 13, 30, 12) $graphics.FillRectangle($lightBrush, 31, 29, 14, 20) $font = [Drawing.Font]::new("Segoe UI", 18, [Drawing.FontStyle]::Bold, [Drawing.GraphicsUnit]::Pixel) $graphics.DrawString("T", $font, $lightBrush, 32, 27) $handle = $bitmap.GetHicon() $icon = [Drawing.Icon]::FromHandle($handle) $stream = [IO.File]::Open($resolvedOutputPath, [IO.FileMode]::Create) try { $icon.Save($stream) } finally { $stream.Dispose() $icon.Dispose() $font.Dispose() $outlinePen.Dispose() $shadowBrush.Dispose() $lightBrush.Dispose() $accentBrush.Dispose() $backgroundBrush.Dispose() $graphics.Dispose() $bitmap.Dispose() } Write-Host "Created icon:" Write-Host " $resolvedOutputPath"