X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fcore%2Ftheme%2Ftheme.service.ts;h=e7a5ae17a52d7e24867fae535e271817c49eb261;hb=8f608a4cb22ab232cfab20665050764b38bac9c7;hp=4c4611d01cab765ba0fbcb33050a20a44d021185;hpb=a4ff3100d36f2fe9a4dfc00e8487c28a94433c4f;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/core/theme/theme.service.ts b/client/src/app/core/theme/theme.service.ts index 4c4611d01..e7a5ae17a 100644 --- a/client/src/app/core/theme/theme.service.ts +++ b/client/src/app/core/theme/theme.service.ts @@ -82,7 +82,19 @@ export class ThemeService { : this.userService.getAnonymousUser().theme if (theme !== 'instance-default') return theme - return this.serverConfig.theme.default + + const instanceTheme = this.serverConfig.theme.default + if (instanceTheme !== 'default') return instanceTheme + + // Default to dark theme if available and wanted by the user + if ( + this.themes.find(t => t.name === 'dark') && + window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches + ) { + return 'dark' + } + + return instanceTheme } private loadTheme (name: string) {