Files
doneit-web/src/app/services/theme.service.ts
T

32 lines
641 B
TypeScript
Raw Normal View History

2021-10-21 14:15:50 +01:00
import { Injectable } from '@angular/core';
import { StorageService } from 'src/app/services/storage.service';
2021-10-21 14:15:50 +01:00
@Injectable({
providedIn: 'root'
})
export class ThemeService {
themes = [
'gov',
2021-10-27 15:10:55 +01:00
'default',
'tribunal'
2021-10-21 14:15:50 +01:00
]
2021-10-21 15:05:37 +01:00
currentTheme = 'gov'
constructor(private storageservice: StorageService) { }
2021-10-21 14:15:50 +01:00
2021-10-27 15:10:55 +01:00
setTheme(theme: 'gov' | 'default' | 'tribunal') {
2021-10-21 16:09:10 +01:00
document.body.classList.remove("gov");
document.body.classList.remove("default");
2021-10-27 15:10:55 +01:00
document.body.classList.remove("tribunal");
2021-10-21 16:09:10 +01:00
document.body.classList.add(theme);
this.currentTheme = theme
2022-04-28 09:32:27 +01:00
this.storageservice.store('theme',theme);
2021-10-21 16:09:10 +01:00
}
2021-10-21 14:15:50 +01:00
}