From c225210a441eae8006df857881aa91c86f9e12dd Mon Sep 17 00:00:00 2001 From: Thomas Rittson Date: Mon, 31 May 2021 13:36:26 +1000 Subject: [PATCH] Respond to native OS theme changes --- src/app/app.component.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index f959f911782..fe82df243d1 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -124,6 +124,11 @@ export class AppComponent implements OnInit { window.onkeypress = () => this.recordActivity(); }); + this.platformUtilsService.onDefaultSystemThemeChange(theme => { + window.document.documentElement.classList.remove('theme_light', 'theme_dark'); + window.document.documentElement.classList.add('theme_' + theme); + }); + this.broadcasterService.subscribe(BroadcasterSubscriptionId, async (message: any) => { this.ngZone.run(async () => { switch (message.command) {