From 70d5aa6f8d6c23ea26ab4e5d84513c9a63a3fbdc Mon Sep 17 00:00:00 2001 From: Sami Mazouz Date: Fri, 21 Jun 2024 12:22:44 +0100 Subject: [PATCH] chore --- framework/core/js/src/common/Application.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/framework/core/js/src/common/Application.tsx b/framework/core/js/src/common/Application.tsx index 03058588d7..7d0a13af38 100644 --- a/framework/core/js/src/common/Application.tsx +++ b/framework/core/js/src/common/Application.tsx @@ -38,6 +38,7 @@ import IHistory from './IHistory'; import IExtender from './extenders/IExtender'; import AccessToken from './models/AccessToken'; import SearchManager from './SearchManager'; +import { ColorScheme } from './components/ThemeMode'; export type FlarumScreens = 'phone' | 'tablet' | 'desktop' | 'desktop-hd'; @@ -386,7 +387,7 @@ export default class Application { } } - getSystemColorSchemePreference(): string { + getSystemColorSchemePreference(): ColorScheme | string { let colorScheme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'; if (window.matchMedia('(prefers-contrast: more)').matches) { @@ -401,8 +402,8 @@ export default class Application { window.matchMedia('(prefers-contrast: more)').addEventListener('change', callback); } - setColorScheme(scheme: string): void { - if (scheme === 'auto') { + setColorScheme(scheme: ColorScheme | string): void { + if (scheme === ColorScheme.Auto) { scheme = this.getSystemColorSchemePreference(); }