feat: make updater window adapt to splash colors
This commit is contained in:
parent
43ca479fc8
commit
186066d791
2 changed files with 21 additions and 15 deletions
|
@ -11,6 +11,23 @@ import { ICON_PATH, VIEW_DIR } from "shared/paths";
|
||||||
|
|
||||||
import { Settings } from "./settings";
|
import { Settings } from "./settings";
|
||||||
|
|
||||||
|
export function patchVencordView(view: BrowserWindow) {
|
||||||
|
const { splashBackground, splashColor, splashTheming } = Settings.store;
|
||||||
|
|
||||||
|
if (splashTheming) {
|
||||||
|
if (splashColor) {
|
||||||
|
const semiTransparentSplashColor = splashColor.replace("rgb(", "rgba(").replace(")", ", 0.2)");
|
||||||
|
|
||||||
|
view.webContents.insertCSS(`body { --fg: ${splashColor} !important }`);
|
||||||
|
view.webContents.insertCSS(`body { --fg-semi-trans: ${semiTransparentSplashColor} !important }`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (splashBackground) {
|
||||||
|
view.webContents.insertCSS(`body { --bg: ${splashBackground} !important }`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export function createSplashWindow() {
|
export function createSplashWindow() {
|
||||||
const splash = new BrowserWindow({
|
const splash = new BrowserWindow({
|
||||||
...SplashProps,
|
...SplashProps,
|
||||||
|
@ -18,21 +35,7 @@ export function createSplashWindow() {
|
||||||
});
|
});
|
||||||
|
|
||||||
splash.loadFile(join(VIEW_DIR, "splash.html"));
|
splash.loadFile(join(VIEW_DIR, "splash.html"));
|
||||||
|
patchVencordView(splash);
|
||||||
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;
|
return splash;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
import { app, BrowserWindow, shell } from "electron";
|
import { app, BrowserWindow, shell } from "electron";
|
||||||
import { Settings } from "main/settings";
|
import { Settings } from "main/settings";
|
||||||
|
import { patchVencordView } from "main/splash";
|
||||||
import { handle } from "main/utils/ipcWrappers";
|
import { handle } from "main/utils/ipcWrappers";
|
||||||
import { makeLinksOpenExternally } from "main/utils/makeLinksOpenExternally";
|
import { makeLinksOpenExternally } from "main/utils/makeLinksOpenExternally";
|
||||||
import { githubGet, ReleaseData } from "main/utils/vencordLoader";
|
import { githubGet, ReleaseData } from "main/utils/vencordLoader";
|
||||||
|
@ -109,10 +110,12 @@ function openNewUpdateWindow() {
|
||||||
contextIsolation: true,
|
contextIsolation: true,
|
||||||
sandbox: true
|
sandbox: true
|
||||||
},
|
},
|
||||||
|
...(process.platform === "darwin" ? { titleBarStyle: "hiddenInset" } : {}),
|
||||||
icon: ICON_PATH
|
icon: ICON_PATH
|
||||||
});
|
});
|
||||||
|
|
||||||
makeLinksOpenExternally(win);
|
makeLinksOpenExternally(win);
|
||||||
|
patchVencordView(win);
|
||||||
|
|
||||||
win.loadFile(join(VIEW_DIR, "updater.html"));
|
win.loadFile(join(VIEW_DIR, "updater.html"));
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue