diff options
author | Chocobozzz <me@florianbigard.com> | 2021-05-11 15:41:13 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-05-11 15:41:13 +0200 |
commit | 5c48aa8c3ef48369235bc3a222bbbe5e08c6bd93 (patch) | |
tree | 41391149eda62d5b48a8c6c644c479db250c200e | |
parent | 3914a50b0732076707a6e4e22f54254ae00fc829 (diff) | |
download | PeerTube-5c48aa8c3ef48369235bc3a222bbbe5e08c6bd93.tar.gz PeerTube-5c48aa8c3ef48369235bc3a222bbbe5e08c6bd93.tar.zst PeerTube-5c48aa8c3ef48369235bc3a222bbbe5e08c6bd93.zip |
Default to dark theme if requested by user
-rw-r--r-- | CHANGELOG.md | 2 | ||||
-rw-r--r-- | client/src/app/core/theme/theme.service.ts | 14 |
2 files changed, 14 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d9f09833..a37ee604d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md | |||
@@ -67,7 +67,7 @@ | |||
67 | 67 | ||
68 | ### Features | 68 | ### Features |
69 | 69 | ||
70 | * :tada: Most robust uploads using a resumable upload endpoint [#3933](https://github.com/Chocobozzz/PeerTube/pull/3933) | 70 | * :tada: More robust uploads using a resumable upload endpoint [#3933](https://github.com/Chocobozzz/PeerTube/pull/3933) |
71 | * Accessibility/UI: | 71 | * Accessibility/UI: |
72 | * :tada: Redesign channel and account page | 72 | * :tada: Redesign channel and account page |
73 | * :tada: Increase video miniature size | 73 | * :tada: Increase video miniature size |
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) { |