ActivityPub-federated video streaming platform using P2P directly in your web browser
remember theme in localStorage
Rigel Kente3f7f600e87a
diff --git a/client/src/app/core/theme/theme.service.ts b/client/src/app/core/theme/theme.service.tsindex d8e02e2e57..17d33b4e50 100644--- a/client/src/app/core/theme/theme.service.ts+++ b/client/src/app/core/theme/theme.service.ts@@ -1,8 +1,10 @@import { Injectable } from '@angular/core'+import { peertubeLocalStorage } from '@app/shared/misc/peertube-local-storage'@Injectable()export class ThemeService {private theme = document.querySelector('body')+ private darkTheme = falseprivate previousTheme = {}constructor () {@@ -12,15 +14,24 @@ export class ThemeService {this.previousTheme['submenuColor'] = 'rgb(32,32,32)'this.previousTheme['inputColor'] = 'gray'this.previousTheme['inputPlaceholderColor'] = '#fff'++ this.darkTheme = (peertubeLocalStorage.getItem('theme') === 'dark')+ console.log(this.darkTheme)+ if (this.darkTheme) this.toggleDarkTheme(false)}- toggleDarkTheme () {+ toggleDarkTheme (setLocalStorage = true) {// switch propertiesthis.switchProperty('mainBackgroundColor')this.switchProperty('mainForegroundColor')this.switchProperty('submenuColor')this.switchProperty('inputColor')this.switchProperty('inputPlaceholderColor')++ if (setLocalStorage) {+ this.darkTheme = !this.darkTheme+ peertubeLocalStorage.setItem('theme', (this.darkTheme) ? 'dark' : 'default')+ }}private switchProperty (property, newValue?) {