auto-dark mode for macOS

This commit is contained in:
Kyle Spearrin 2019-07-24 14:48:08 -04:00
parent e915e81fdd
commit 54375acf58
2 changed files with 5 additions and 2 deletions

2
jslib

@ -1 +1 @@
Subproject commit e89f295e1d59040bf48ba599a900e3b42497008e Subproject commit 0aae22fc00dc1d9ec96480d2262c5f35d0fd0d67

View File

@ -15,6 +15,8 @@ import { ElectronRendererSecureStorageService } from 'jslib/electron/services/el
import { ElectronStorageService } from 'jslib/electron/services/electronStorage.service'; import { ElectronStorageService } from 'jslib/electron/services/electronStorage.service';
import { isDev } from 'jslib/electron/utils'; import { isDev } from 'jslib/electron/utils';
import { DeviceType } from 'jslib/enums/deviceType';
import { I18nService } from '../services/i18n.service'; import { I18nService } from '../services/i18n.service';
import { AuthGuardService } from 'jslib/angular/services/auth-guard.service'; import { AuthGuardService } from 'jslib/angular/services/auth-guard.service';
@ -140,7 +142,8 @@ export function initFactory(): Function {
htmlEl.classList.add('locale_' + i18nService.translationLocale); htmlEl.classList.add('locale_' + i18nService.translationLocale);
let theme = await storageService.get<string>(ConstantsService.themeKey); let theme = await storageService.get<string>(ConstantsService.themeKey);
if (theme == null) { if (theme == null) {
theme = 'light'; theme = platformUtilsService.getDevice() === DeviceType.MacOsDesktop &&
remote.systemPreferences.isDarkMode() ? 'dark' : 'light';
} }
htmlEl.classList.add('theme_' + theme); htmlEl.classList.add('theme_' + theme);
stateService.save(ConstantsService.disableFaviconKey, stateService.save(ConstantsService.disableFaviconKey,