chore: Fix app

This commit is contained in:
2026-07-14 00:41:05 +02:00
parent 3e090933fd
commit edc4d935d8
98 changed files with 2878 additions and 155 deletions
+38 -1
View File
@@ -34,6 +34,12 @@ const LEGACY_ICON_PX = { mdpi: 48, hdpi: 72, xhdpi: 96, xxhdpi: 144, xxxhdpi: 19
/** Adaptive foreground canvas edge length per density (108dp). */
const FOREGROUND_PX = { mdpi: 108, hdpi: 162, xhdpi: 216, xxhdpi: 324, xxxhdpi: 432 };
/** Notification status-bar icon edge length per density (24dp). */
const NOTIFICATION_ICON_PX = { mdpi: 24, hdpi: 36, xhdpi: 48, xxhdpi: 72, xxxhdpi: 96 };
/** Luminance cut separating the white cat glyph from the purple disc when building the alpha mask. */
const NOTIFICATION_ICON_LUMINANCE_THRESHOLD = 160;
/** Portrait splash dimensions per density; landscape swaps width/height. */
const SPLASH_PORTRAIT = {
mdpi: [320, 480],
@@ -106,6 +112,36 @@ async function generateLauncherIcons() {
return written;
}
/**
* Android status-bar icons are rendered as alpha-only silhouettes, so extract the
* white cat glyph from the brand mark (luminance threshold) and paint it white.
*/
async function notificationStatusIcon(size) {
const alphaMask = await sharp(SOURCE_ICON)
.resize(size, size, { fit: 'contain', background: { r: 0, g: 0, b: 0, alpha: 0 } })
.removeAlpha()
.greyscale()
.threshold(NOTIFICATION_ICON_LUMINANCE_THRESHOLD)
.png()
.toBuffer();
return sharp({ create: { width: size, height: size, channels: 3, background: { r: 255, g: 255, b: 255 } } })
.joinChannel(alphaMask)
.png()
.toBuffer();
}
async function generateNotificationStatusIcons() {
const written = [];
for (const [density, size] of Object.entries(NOTIFICATION_ICON_PX)) {
const icon = await notificationStatusIcon(size);
written.push(await writePng(icon, `drawable-${density}/ic_stat_metoyou.png`));
}
return written;
}
async function generateAdaptiveBackgroundColor() {
const xml = `<?xml version="1.0" encoding="utf-8"?>\n<resources>\n <color name="ic_launcher_background">${BRAND_BACKGROUND_HEX}</color>\n</resources>\n`;
const outPath = resolve(RES_DIR, 'values/ic_launcher_background.xml');
@@ -134,7 +170,8 @@ async function main() {
const written = [
...(await generateLauncherIcons()),
await generateAdaptiveBackgroundColor(),
...(await generateSplashScreens())
...(await generateSplashScreens()),
...(await generateNotificationStatusIcons())
];
console.log(`Generated ${written.length} Android brand resources from ${SOURCE_ICON}:`);