1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 00:33:44 +00:00

Add theme enums and platformUtilsService helper (#497)

* Use enum for themes, add getEffectiveTheme

* Update electron and cli to use theme refactor
This commit is contained in:
Thomas Rittson
2021-09-30 06:37:36 +10:00
committed by GitHub
parent 91b73fa777
commit ce71c0c0bd
5 changed files with 35 additions and 7 deletions

View File

@@ -3,6 +3,8 @@ import { promises as fs } from 'fs';
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
import { RendererMenuItem } from '../utils';
import { ThemeType } from 'jslib-common/enums/themeType';
import { WindowMain } from '../window.main';
export class ElectronMainMessagingService implements MessagingService {
@@ -12,7 +14,7 @@ export class ElectronMainMessagingService implements MessagingService {
});
ipcMain.handle('systemTheme', () => {
return nativeTheme.shouldUseDarkColors ? 'dark' : 'light';
return nativeTheme.shouldUseDarkColors ? ThemeType.Dark : ThemeType.Light;
});
ipcMain.handle('showMessageBox', (event, options) => {
@@ -42,7 +44,7 @@ export class ElectronMainMessagingService implements MessagingService {
});
nativeTheme.on('updated', () => {
windowMain.win?.webContents.send('systemThemeUpdated', nativeTheme.shouldUseDarkColors ? 'dark' : 'light');
windowMain.win?.webContents.send('systemThemeUpdated', nativeTheme.shouldUseDarkColors ? ThemeType.Dark : ThemeType.Light);
});
}