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:
@@ -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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user