Files
Password-Manager/android-client/theme/make-style.ps1
T
r-zakarya ceaba331d8 feat(android): the search field takes the shape Android uses for search
I had followed the desktop capture - a squared field with slightly rounded corners - without thinking of the search bar the phone itself uses. On a phone that pill is the reference, and the app should look like where it runs.

Edits become pills; the memo keeps its sober corners. A magnifier is drawn inside the field, as a circle and a handle rather than a glyph, since no font is guaranteed across devices. Drawing inside a TEdit works - it is only the clickable that does not, which is why the clear cross stays beside it.

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

59 lines
2.5 KiB
PowerShell

# Fabrique pm-dark.style depuis le Dark.style livre avec Delphi, en recolorant
# les deux controles dont le fond reste visible.
#
# POURQUOI PATCHER PLUTOT QUE RENDRE TRANSPARENT : Dark.style ne contient aucun
# gabarit 'transparentedit' ni 'transparentmemostyle' - un StyleLookup vers eux
# retombe silencieusement sur le gabarit normal, avec son fond gris. Le champ
# de recherche et le journal juraient donc avec le reste de l'interface, qui
# est peint.
#
# Tout le reste de l'application ne depend plus d'aucun gabarit : ce style ne
# sert qu'aux controles natifs qu'on ne reecrit pas.
#
# A relancer si la palette de PMA.Theme change, puis recompiler la ressource :
# brcc32 theme.rc -fotheme.res
$ErrorActionPreference = 'Stop'
$src = 'C:\Program Files (x86)\Embarcadero\Studio\23.0\Redist\styles\Fmx\Dark.style'
$dst = Join-Path $PSScriptRoot 'pm-dark.style'
# Doivent suivre les constantes de PMA.Theme.
$surface = 'xFF1E293B' # COL_SURFACE
$border = 'xFF334155' # COL_RAISED, en bordure discrete
$text = 'xFFE2E8F0' # COL_TEXT
$lines = Get-Content $src
$patched = 0
foreach ($style in 'editstyle', 'memostyle') {
$at = ($lines | Select-String -Pattern "StyleName = '$style'" | Select-Object -First 1).LineNumber
if (-not $at) { Write-Warning "$style introuvable"; continue }
# Un champ de saisie prend la forme d'une pilule, comme la barre de
# recherche d'Android ; un memo garde ses coins sobres.
if ($style -eq 'editstyle') { $radius = '24.000000000000000000' }
else { $radius = '10.000000000000000000' }
# La fenetre couvre le bloc 'background' qui suit immediatement le nom.
for ($i = $at; $i -lt [Math]::Min($at + 24, $lines.Count); $i++) {
switch -Regex ($lines[$i]) {
'Fill\.Color = x' { $lines[$i] = $lines[$i] -replace 'x[0-9A-Fa-f]{8}', $surface; $patched++ }
'Stroke\.Color = x' { $lines[$i] = $lines[$i] -replace 'x[0-9A-Fa-f]{8}', $border; $patched++ }
'XRadius = ' { $lines[$i] = $lines[$i] -replace '[\d.]+$', $radius }
'YRadius = ' { $lines[$i] = $lines[$i] -replace '[\d.]+$', $radius }
}
}
# Couleur du texte saisi : 'foreground' vient juste apres le fond.
for ($i = $at; $i -lt [Math]::Min($at + 34, $lines.Count); $i++) {
if ($lines[$i] -match "StyleName = 'foreground'") {
$lines[$i+1] = $lines[$i+1] -replace 'x[0-9A-Fa-f]{8}', $text
break
}
}
}
Set-Content $dst $lines -Encoding UTF8
"pm-dark.style ecrit, $patched couleurs remplacees"