Files
Password-Manager/android-client/make-icons.ps1
T
r-zakarya 8f9ebb8d47 feat(android): blue instead of cyan, everywhere at once
Cyan came from the desktop app. On the phone the reference is the system: its global search and its own apps are blue, and an app should look like the place it runs.

Accent #3B82F6 on the same slate, with white on the accent since blue is darker than cyan. The launcher icon and the launch screen follow - a cyan padlock in front of a blue interface would have read as a different app.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-15 19:55:06 +01:00

69 lines
3.0 KiB
PowerShell

# Genere les icones PNG du lanceur, pour Android < 8 qui ignore les icones
# adaptatives. Meme dessin que les vecteurs de android-res\drawable :
# cadenas cyan sur ardoise.
#
# A relancer seulement si le dessin change ; les PNG sont suivis par git.
$ErrorActionPreference = 'Stop'
Add-Type -AssemblyName System.Drawing
$root = Join-Path $PSScriptRoot 'android-res'
$bg = [System.Drawing.Color]::FromArgb(255, 15, 23, 42) # #0F172A
$fg = [System.Drawing.Color]::FromArgb(255, 59, 130, 246) # #3B82F6
# densite -> cote en pixels, tel qu'Android les attend
$sizes = @{ 'drawable-ldpi' = 36; 'drawable-mdpi' = 48; 'drawable-hdpi' = 72
'drawable-xhdpi' = 96; 'drawable-xxhdpi' = 144; 'drawable-xxxhdpi' = 192 }
foreach ($dir in $sizes.Keys) {
$n = $sizes[$dir]
$out = Join-Path $root $dir
New-Item -ItemType Directory -Force $out | Out-Null
$bmp = New-Object System.Drawing.Bitmap $n, $n
$g = [System.Drawing.Graphics]::FromImage($bmp)
$g.SmoothingMode = 'AntiAlias'
# Fond : carre arrondi. Les vieux lanceurs ne masquent pas, donc l'icone
# doit porter sa propre forme.
$r = [int]($n * 0.22)
$path = New-Object System.Drawing.Drawing2D.GraphicsPath
$path.AddArc(0, 0, 2*$r, 2*$r, 180, 90)
$path.AddArc($n-2*$r-1, 0, 2*$r, 2*$r, 270, 90)
$path.AddArc($n-2*$r-1, $n-2*$r-1, 2*$r, 2*$r, 0, 90)
$path.AddArc(0, $n-2*$r-1, 2*$r, 2*$r, 90, 90)
$path.CloseFigure()
$g.FillPath((New-Object System.Drawing.SolidBrush $bg), $path)
# Echelle : le dessin vectoriel vit dans un carre de 108.
$u = $n / 108.0
$brush = New-Object System.Drawing.SolidBrush $fg
$pen = New-Object System.Drawing.Pen $fg, ([float](5.5 * $u))
$pen.StartCap = 'Round'; $pen.EndCap = 'Round'
# Anse : demi-cercle ouvert vers le bas, puis deux montants.
$g.DrawArc($pen, [float](44*$u), [float](37*$u), [float](20*$u), [float](20*$u), 180, 180)
$g.DrawLine($pen, [float](44*$u), [float](47*$u), [float](44*$u), [float](56*$u))
$g.DrawLine($pen, [float](64*$u), [float](47*$u), [float](64*$u), [float](56*$u))
# Corps
$body = New-Object System.Drawing.Drawing2D.GraphicsPath
$bx = 34*$u; $by = 54*$u; $bw = 40*$u; $bh = 26*$u; $br = 4*$u
$body.AddArc([float]$bx, [float]$by, [float](2*$br), [float](2*$br), 180, 90)
$body.AddArc([float]($bx+$bw-2*$br), [float]$by, [float](2*$br), [float](2*$br), 270, 90)
$body.AddArc([float]($bx+$bw-2*$br), [float]($by+$bh-2*$br), [float](2*$br), [float](2*$br), 0, 90)
$body.AddArc([float]$bx, [float]($by+$bh-2*$br), [float](2*$br), [float](2*$br), 90, 90)
$body.CloseFigure()
$g.FillPath($brush, $body)
# Serrure, evidee dans la couleur du fond
$bgBrush = New-Object System.Drawing.SolidBrush $bg
$g.FillEllipse($bgBrush, [float](50*$u), [float](58*$u), [float](8*$u), [float](8*$u))
$g.FillRectangle($bgBrush, [float](52.4*$u), [float](64*$u), [float](3.2*$u), [float](9*$u))
$g.Dispose()
$bmp.Save((Join-Path $out 'ic_launcher.png'), [System.Drawing.Imaging.ImageFormat]::Png)
$bmp.Dispose()
"{0,-20} {1}x{1}" -f $dir, $n
}