feat: added dark and light mode

This commit is contained in:
shahdlala66
2026-04-22 08:19:16 +02:00
parent 91fa247696
commit c18026bce6
6 changed files with 319 additions and 10 deletions
+12 -2
View File
@@ -1,4 +1,4 @@
import { Component } from '@angular/core';
import { Component, OnInit } from '@angular/core';
import { RouterOutlet } from '@angular/router';
@Component({
@@ -7,5 +7,15 @@ import { RouterOutlet } from '@angular/router';
templateUrl: './app.html',
styleUrl: './app.css'
})
export class App {
export class App implements OnInit {
ngOnInit(): void {
this.initTheme();
}
private initTheme(): void {
const savedTheme = localStorage.getItem('theme');
if (savedTheme === 'dark') {
document.documentElement.setAttribute('data-theme', 'dark');
}
}
}