Path: blob/main/replay/frontend/src/models/OverlayStore.ts
1029 views
import { ipcRenderer, remote } from 'electron';1import { getTheme } from '~shared/utils/themes';2import settings from '~frontend/lib/settings';34export class OverlayStore {5public get theme() {6return getTheme(settings.theme);7}89public get cssVars() {10const dialogLightForeground = this.theme.dialogLightForeground;11return {12'--dropdownBackgroundColor': this.theme.dropdownBackgroundColor,13'--menuItemHoverBackgroundColor': dialogLightForeground14? 'rgba(255, 255, 255, 0.06)'15: 'rgba(0, 0, 0, 0.03)',16};17}1819public constructor(hideOnBlur = true) {20if (hideOnBlur) {21window.addEventListener('blur', () => {22this.hide();23});24}25}2627public get webContentsId() {28return remote.getCurrentWebContents().id;29}3031public hide() {32ipcRenderer.send('overlay:hide', this.webContentsId);33}34}353637