Browse Source

Remember the selected theme

new_auth
Quildra 2 years ago
parent
commit
77f40d9cf8
  1. 5
      packages/bridge-ui/src/app/app.component.ts
  2. 4
      packages/bridge-ui/src/app/services/theme.service.ts

5
packages/bridge-ui/src/app/app.component.ts

@ -19,6 +19,11 @@ export class AppComponent {
constructor (private themeService: ThemeService) {}
ngOnInit() {
const style = localStorage.getItem('style');
if(style != undefined) {
this.themeService.setTheme(style);
} else {
this.themeService.setTheme(this.defaultTheme);
}
}
}

4
packages/bridge-ui/src/app/services/theme.service.ts

@ -13,7 +13,8 @@ export class ThemeService {
constructor(
private httpClient: HttpClient,
private styleManagerService: StyleManagerService) { }
private styleManagerService: StyleManagerService) {
}
getThemeOptions(): Observable<Array<ThemeOption>> {
return this.httpClient.get<Array<ThemeOption>>("assets/theme-options.json");
@ -24,5 +25,6 @@ export class ThemeService {
"theme",
`${selectedTheme}.css`
)
localStorage.setItem('style', selectedTheme);
}
}

Loading…
Cancel
Save