import { Component, OnInit } from '@angular/core'; import { CoreService } from '../../core.service'; @Component({ selector: 'core-themeselector', templateUrl: './themeselector.component.html', styleUrls: ['./themeselector.component.css'] }) export class ThemeselectorComponent implements OnInit { theme: string; constructor(private core: CoreService) { } ngOnInit() { this.changeTheme(localStorage.theme || "blue"); } changeTheme(themeName: string) { localStorage.theme = themeName; this.theme = themeName; var link = document.getElementById('themeAsset'); link.href = this.core.getBaseUrl() + `assets/theme/${themeName}.css`; } }