mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-05 22:02:15 +00:00
34 lines
778 B
TypeScript
34 lines
778 B
TypeScript
import { Injectable } from '@angular/core';
|
|
import { BehaviorSubject, Observable } from 'rxjs';
|
|
|
|
declare const tinycolor: any;
|
|
|
|
export interface Color {
|
|
name: string;
|
|
hex: string;
|
|
rgb: string;
|
|
contrastColor: string;
|
|
}
|
|
|
|
@Injectable()
|
|
export class ThemeService {
|
|
private _darkTheme: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(true);
|
|
public isDarkTheme: Observable<boolean> = this._darkTheme.asObservable();
|
|
public loading: boolean = false;
|
|
|
|
constructor() {
|
|
const theme = localStorage.getItem('theme');
|
|
if (theme) {
|
|
if (theme === 'light-theme') {
|
|
this.setDarkTheme(false);
|
|
} else {
|
|
this.setDarkTheme(true);
|
|
}
|
|
}
|
|
}
|
|
|
|
setDarkTheme(isDarkTheme: boolean): void {
|
|
this._darkTheme.next(isDarkTheme);
|
|
}
|
|
}
|