Files
makelore/electron/main/window-material.ts

25 lines
938 B
TypeScript

import type { BrowserWindowConstructorOptions } from 'electron';
type NativeWindowMaterialOptions = Pick<
BrowserWindowConstructorOptions,
'backgroundColor' | 'transparent' | 'vibrancy' | 'visualEffectState'
>;
/**
* Use the native macOS material only where Electron and the window manager
* support it. Other platforms keep the normal opaque window as a safe fallback.
*/
export function getNativeWindowMaterialOptions(
platform: NodeJS.Platform,
): NativeWindowMaterialOptions {
// Keep every platform on the same opaque surface. Native vibrancy forces
// transparent compositing and makes every backdrop-filter pay the cost of
// sampling the window behind it. Makelore's light palette already provides
// the visual hierarchy without a native material layer.
return {
backgroundColor: '#FFFFFF',
transparent: false,
...(platform === 'darwin' ? { visualEffectState: 'inactive' as const } : {}),
};
}