1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-13 14:53:33 +00:00

detect dark theme based on system theme (#271)

This commit is contained in:
Kyle Spearrin
2021-02-12 11:04:09 -05:00
committed by GitHub
parent 0951424de7
commit 0b79f112b9

View File

@@ -3,7 +3,6 @@ import {
ipcRenderer, ipcRenderer,
remote, remote,
shell, shell,
// nativeTheme,
} from 'electron'; } from 'electron';
import * as fs from 'fs'; import * as fs from 'fs';
@@ -222,14 +221,13 @@ export class ElectronPlatformUtilsService implements PlatformUtilsService {
} }
getDefaultSystemTheme() { getDefaultSystemTheme() {
return 'light' as 'light' | 'dark'; return remote.nativeTheme.shouldUseDarkColors ? 'dark' : 'light';
// return nativeTheme.shouldUseDarkColors ? 'dark' : 'light';
} }
onDefaultSystemThemeChange(callback: ((theme: 'light' | 'dark') => unknown)) { onDefaultSystemThemeChange(callback: ((theme: 'light' | 'dark') => unknown)) {
// nativeTheme.on('updated', () => { remote.nativeTheme.on('updated', () => {
// callback(this.getDefaultSystemTheme()); callback(this.getDefaultSystemTheme());
// }); });
} }
supportsSecureStorage(): boolean { supportsSecureStorage(): boolean {