create-tab-icons.ps1 2.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. # Source for the committed navigation PNG assets; run from the project root.
  2. Add-Type -AssemblyName System.Drawing
  3. $assetDirectory = Join-Path $PSScriptRoot '../src/assets/tab'
  4. [System.IO.Directory]::CreateDirectory($assetDirectory) | Out-Null
  5. foreach ($kind in @('home', 'profile')) {
  6. foreach ($active in @($false, $true)) {
  7. $bitmap = New-Object System.Drawing.Bitmap 81, 81
  8. $canvas = [System.Drawing.Graphics]::FromImage($bitmap)
  9. $canvas.SmoothingMode = [System.Drawing.Drawing2D.SmoothingMode]::AntiAlias
  10. $canvas.Clear([System.Drawing.Color]::Transparent)
  11. $accent = if ($active) { '#873cff' } else { '#92929c' }
  12. $brush = New-Object System.Drawing.SolidBrush ([System.Drawing.ColorTranslator]::FromHtml($accent))
  13. if ($kind -eq 'home') {
  14. $roofBrush = New-Object System.Drawing.SolidBrush ([System.Drawing.ColorTranslator]::FromHtml($(if ($active) { '#ff875f' } else { '#c6b8b0' })))
  15. $wallBrush = New-Object System.Drawing.SolidBrush ([System.Drawing.ColorTranslator]::FromHtml($(if ($active) { '#ffe2b2' } else { '#e4dfd9' })))
  16. $doorBrush = New-Object System.Drawing.SolidBrush ([System.Drawing.ColorTranslator]::FromHtml($(if ($active) { '#61cbb5' } else { '#a8bfb8' })))
  17. $roof = [System.Drawing.PointF[]]@((New-Object System.Drawing.PointF 8, 38), (New-Object System.Drawing.PointF 40, 9), (New-Object System.Drawing.PointF 73, 38), (New-Object System.Drawing.PointF 65, 43), (New-Object System.Drawing.PointF 40, 21), (New-Object System.Drawing.PointF 16, 44))
  18. $canvas.FillRectangle($wallBrush, 20, 36, 42, 35)
  19. $canvas.FillPolygon($roofBrush, $roof)
  20. $canvas.FillRectangle($doorBrush, 34, 48, 14, 23)
  21. $canvas.FillRectangle($roofBrush, 55, 13, 7, 17)
  22. $roofBrush.Dispose(); $wallBrush.Dispose(); $doorBrush.Dispose()
  23. } else {
  24. $canvas.FillEllipse($brush, 27, 9, 28, 32)
  25. $canvas.FillEllipse($brush, 22, 28, 9, 12)
  26. $canvas.FillEllipse($brush, 51, 28, 9, 12)
  27. $canvas.FillEllipse($brush, 15, 43, 52, 42)
  28. $canvas.FillRectangle($brush, 15, 62, 52, 11)
  29. }
  30. $suffix = if ($active) { '-active' } else { '' }
  31. $bitmap.Save((Join-Path $assetDirectory "$kind$suffix.png"), [System.Drawing.Imaging.ImageFormat]::Png)
  32. $brush.Dispose(); $canvas.Dispose(); $bitmap.Dispose()
  33. }
  34. }