haitop/src/main/splash.ts
V 2f35128acf
Revert "feat: Add start as minimized toggle to settings (#248)" (#310)
the current implementation was prematurely merged and is broken. it will be back with a fixed implementaton eventually
2023-12-28 04:25:54 +01:00

38 lines
1.2 KiB
TypeScript

/*
* SPDX-License-Identifier: GPL-3.0
* Vesktop, a desktop app aiming to give you a snappier Discord Experience
* Copyright (c) 2023 Vendicated and Vencord contributors
*/
import { BrowserWindow } from "electron";
import { join } from "path";
import { SplashProps } from "shared/browserWinProperties";
import { ICON_PATH, VIEW_DIR } from "shared/paths";
import { Settings } from "./settings";
export function createSplashWindow() {
const splash = new BrowserWindow({
...SplashProps,
icon: ICON_PATH
});
splash.loadFile(join(VIEW_DIR, "splash.html"));
const { splashBackground, splashColor, splashTheming } = Settings.store;
if (splashTheming) {
if (splashColor) {
const semiTransparentSplashColor = splashColor.replace("rgb(", "rgba(").replace(")", ", 0.2)");
splash.webContents.insertCSS(`body { --fg: ${splashColor} !important }`);
splash.webContents.insertCSS(`body { --fg-semi-trans: ${semiTransparentSplashColor} !important }`);
}
if (splashBackground) {
splash.webContents.insertCSS(`body { --bg: ${splashBackground} !important }`);
}
}
return splash;
}