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