mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 16:23:44 +00:00
Merge pull request #929 from bitwarden/responsive-theme-change
Respond to OS theme changes
This commit is contained in:
2
jslib
2
jslib
Submodule jslib updated: 25a91313ad...b1d9b84eae
@@ -156,11 +156,11 @@ export function initFactory(): Function {
|
||||
htmlEl.classList.add('locale_' + i18nService.translationLocale);
|
||||
let theme = await storageService.get<string>(ConstantsService.themeKey);
|
||||
if (theme == null) {
|
||||
if (platformUtilsService.getDevice() === DeviceType.MacOsDesktop) {
|
||||
theme = await platformUtilsService.getDefaultSystemTheme();
|
||||
} else {
|
||||
theme = 'light';
|
||||
}
|
||||
platformUtilsService.onDefaultSystemThemeChange(sysTheme => {
|
||||
window.document.documentElement.classList.remove('theme_light', 'theme_dark');
|
||||
window.document.documentElement.classList.add('theme_' + sysTheme);
|
||||
});
|
||||
}
|
||||
htmlEl.classList.add('theme_' + theme);
|
||||
stateService.save(ConstantsService.disableFaviconKey,
|
||||
|
||||
Reference in New Issue
Block a user