You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
frontend/src/app/app.component.ts

26 lines
781 B
TypeScript

4 years ago
import { Component, Renderer2 } from '@angular/core';
import { ColorThemeService } from './services/colorTheme.service';
4 years ago
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'],
4 years ago
})
export class AppComponent {
title = 'flotte-frontend';
4 years ago
darkThemeIsActive: boolean = false;
4 years ago
constructor(
private renderer: Renderer2,
private themeService: ColorThemeService
) {
this.renderer.addClass(document.body, 'mat-app-background'); //so the background color changes dependent on current theme
this.themeService.load();
4 years ago
this.darkThemeIsActive = this.themeService.currentActive() === 'dark-theme';
}
changeTheme(event) {
this.themeService.update(event.checked ? 'dark-theme' : 'light-theme');
4 years ago
}
4 years ago
}