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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 6 deletions

View File

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