aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-05-11 15:41:13 +0200
committerChocobozzz <me@florianbigard.com>2021-05-11 15:41:13 +0200
commit5c48aa8c3ef48369235bc3a222bbbe5e08c6bd93 (patch)
tree41391149eda62d5b48a8c6c644c479db250c200e /client/src
parent3914a50b0732076707a6e4e22f54254ae00fc829 (diff)
downloadPeerTube-5c48aa8c3ef48369235bc3a222bbbe5e08c6bd93.tar.gz
PeerTube-5c48aa8c3ef48369235bc3a222bbbe5e08c6bd93.tar.zst
PeerTube-5c48aa8c3ef48369235bc3a222bbbe5e08c6bd93.zip
Default to dark theme if requested by user
Diffstat (limited to 'client/src')
-rw-r--r--client/src/app/core/theme/theme.service.ts14
1 files changed, 13 insertions, 1 deletions
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 {
82 : this.userService.getAnonymousUser().theme 82 : this.userService.getAnonymousUser().theme
83 83
84 if (theme !== 'instance-default') return theme 84 if (theme !== 'instance-default') return theme
85 return this.serverConfig.theme.default 85
86 const instanceTheme = this.serverConfig.theme.default
87 if (instanceTheme !== 'default') return instanceTheme
88
89 // Default to dark theme if available and wanted by the user
90 if (
91 this.themes.find(t => t.name === 'dark') &&
92 window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches
93 ) {
94 return 'dark'
95 }
96
97 return instanceTheme
86 } 98 }
87 99
88 private loadTheme (name: string) { 100 private loadTheme (name: string) {