应用磁贴: 有logo白底图盖满, 无logo才用彩色首字块(colorTheme全blue不能当统一底色) (v26090721)

This commit is contained in:
2026-09-08 01:46:23 +08:00
parent 2af6def2fd
commit 98534bd8e2
2 changed files with 10 additions and 7 deletions

View File

@@ -197,10 +197,13 @@
grid.innerHTML = apps.map(a => {
const ico = a.logo || a.icon || '';
const name = a.name || a.identifier || '应用';
const color = a.colorTheme || appTileColor(name);
/* 有 logo:白底让图盖满;无 logo:用 colorTheme/调色板 + 首字彩色块。
⚠️ colorTheme 目前全是 'blue' 这种颜色名 —— 有图时别拿它当底色,
不然 37 个磁贴清一色蓝块,图加载前像坏了。 */
const bg = ico ? 'background:#fff' : 'background:' + (a.colorTheme || appTileColor(name));
const img = ico ? '<img src="' + ico + '" alt="" loading="lazy">' : (name.slice(0, 1));
return '<button class="app-tile ripple" data-url="' + encodeURIComponent(a.url) + '">' +
'<span class="app-ico" style="background:' + color + '">' + img + '</span>' +
'<span class="app-ico" style="' + bg + '">' + img + '</span>' +
'<span class="app-tile-name">' + name + '</span></button>';
}).join('');
/* 磁贴点击(事件委托,innerHTML 重建后不用重绑) */