mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-08-22 08:53:46 +08:00
🐛 fix(titlebar): 修复暗色主题标题栏图标白底
- 为默认品牌图标增加透明紧凑标题栏素材 - 增加独立标题栏资源解析并保留其他品牌图标现有展示 - 移除标题栏图标强制白色背景 - 补充默认图标、未知图标回退及透明素材测试
This commit is contained in:
@@ -13,6 +13,9 @@ const brandIconsSource = readFileSync(
|
||||
const brandIconsDirectory = fileURLToPath(
|
||||
new globalThis.URL('../public/brand-icons/', import.meta.url),
|
||||
);
|
||||
const defaultTitlebarMark = fileURLToPath(
|
||||
new globalThis.URL('../public/brand-marks/02-database-search-transparent.png', import.meta.url),
|
||||
);
|
||||
|
||||
describe('about brand lockup', () => {
|
||||
it('uses a transparent lockup without a tile background on the about page', () => {
|
||||
@@ -25,6 +28,15 @@ describe('about brand lockup', () => {
|
||||
expect(aboutLogoSnippet).toContain("boxShadow: 'none'");
|
||||
});
|
||||
|
||||
it('uses the transparent compact mark without a forced titlebar tile', () => {
|
||||
expect(appSource).toContain('src={resolveBrandTitlebarSrc(brandIconId)}');
|
||||
|
||||
const titlebarLogoStart = appSource.indexOf('src={resolveBrandTitlebarSrc(brandIconId)}');
|
||||
const titlebarLogoSnippet = appSource.slice(titlebarLogoStart, titlebarLogoStart + 640);
|
||||
expect(titlebarLogoSnippet).toContain("background: 'transparent'");
|
||||
expect(readFileSync(defaultTitlebarMark)).not.toHaveLength(0);
|
||||
});
|
||||
|
||||
it('keeps one shared lossless WebP asset for every selectable mascot', () => {
|
||||
const iconAssetPaths = brandIconsSource.match(/iconPath: '\/brand-icons\/\d{2}-.+\.webp'/g) || [];
|
||||
expect(iconAssetPaths).toHaveLength(10);
|
||||
|
||||
@@ -33,6 +33,7 @@ import {
|
||||
resolveBrandAboutSrc,
|
||||
resolveBrandDockSrc,
|
||||
resolveBrandIconSrc,
|
||||
resolveBrandTitlebarSrc,
|
||||
type BrandIconId,
|
||||
} from './brand/brandIcons';
|
||||
import { composeMacOSDockIconBase64, shouldSyncMacOSDockIcon } from './brand/macDockIcon';
|
||||
@@ -6908,7 +6909,7 @@ function App() {
|
||||
>
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: Math.max(6, Math.round(8 * effectiveUiScale)), fontWeight: 600, minWidth: 0 }}>
|
||||
<img
|
||||
src={resolveBrandIconSrc(brandIconId)}
|
||||
src={resolveBrandTitlebarSrc(brandIconId)}
|
||||
alt="GoNavi"
|
||||
width={Math.max(24, Math.round(28 * effectiveUiScale))}
|
||||
height={Math.max(24, Math.round(28 * effectiveUiScale))}
|
||||
@@ -6919,7 +6920,7 @@ function App() {
|
||||
objectFit: 'contain',
|
||||
borderRadius: 8,
|
||||
flexShrink: 0,
|
||||
background: '#fff',
|
||||
background: 'transparent',
|
||||
}}
|
||||
/>
|
||||
GoNavi
|
||||
|
||||
@@ -5,6 +5,7 @@ import {
|
||||
resolveBrandDockSrc,
|
||||
resolveBrandFullSrc,
|
||||
resolveBrandIconSrc,
|
||||
resolveBrandTitlebarSrc,
|
||||
} from './brandIcons';
|
||||
|
||||
describe('brand icon asset resolution', () => {
|
||||
@@ -17,4 +18,12 @@ describe('brand icon asset resolution', () => {
|
||||
expect(resolveBrandDockSrc(icon.id)).toBe(selectedAsset);
|
||||
}
|
||||
});
|
||||
|
||||
it('uses the transparent compact mark for the default titlebar icon', () => {
|
||||
const defaultTitlebarAsset = '/brand-marks/02-database-search-transparent.png';
|
||||
expect(resolveBrandTitlebarSrc('02')).toBe(defaultTitlebarAsset);
|
||||
expect(resolveBrandTitlebarSrc()).toBe(defaultTitlebarAsset);
|
||||
expect(resolveBrandTitlebarSrc('unknown')).toBe(defaultTitlebarAsset);
|
||||
expect(resolveBrandTitlebarSrc('01')).toBe(resolveBrandIconSrc('01'));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -16,6 +16,7 @@ export type BrandIconDefinition = {
|
||||
titleZh: string;
|
||||
titleEn: string;
|
||||
iconPath: string;
|
||||
titlebarPath?: string;
|
||||
};
|
||||
|
||||
export const DEFAULT_BRAND_ICON_ID: BrandIconId = '02';
|
||||
@@ -34,6 +35,7 @@ export const BRAND_ICONS: BrandIconDefinition[] = [
|
||||
titleZh: '搜库小狗',
|
||||
titleEn: 'Database search',
|
||||
iconPath: '/brand-icons/02-database-search.webp',
|
||||
titlebarPath: '/brand-marks/02-database-search-transparent.png',
|
||||
},
|
||||
{
|
||||
id: '03',
|
||||
@@ -119,6 +121,11 @@ export function resolveBrandAboutSrc(id?: unknown): string {
|
||||
return resolveBrandIconSrc(id);
|
||||
}
|
||||
|
||||
export function resolveBrandTitlebarSrc(id?: unknown): string {
|
||||
const icon = resolveBrandIcon(id);
|
||||
return icon.titlebarPath || icon.iconPath;
|
||||
}
|
||||
|
||||
/** Dock uses the exact lossless WebP lockup rendered by BrandIconPicker. */
|
||||
export function resolveBrandDockSrc(id?: unknown): string {
|
||||
return resolveBrandIconSrc(id);
|
||||
|
||||
Reference in New Issue
Block a user