Skip to content

Commit

Permalink
chore
Browse files Browse the repository at this point in the history
  • Loading branch information
SychO9 committed Jun 21, 2024
1 parent 5cf21d9 commit 70d5aa6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions framework/core/js/src/common/Application.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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) {
Expand All @@ -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();
}

Expand Down

0 comments on commit 70d5aa6

Please sign in to comment.