import { Component, OnInit } from '@angular/core';
import { ColorModeService, GetLocalTheme, Theme } from '../../../services/button/color-mode.service';
import { CommonModule } from '@angular/common'

@Component({
  standalone: true,
  imports: [CommonModule],
  selector: 'app-color-mode-bttn',
  templateUrl: './color-mode-bttn.component.html',
  styleUrl: './color-mode-bttn.component.css'
})
export class ColorModeBttnComponent implements OnInit {
  constructor(private cModeService: ColorModeService) {
    this.theme = GetLocalTheme();
  }

  ngOnInit(): void {
    this.cModeService.updateTheme();
  }

  readonly Themes = Theme;

  theme: Theme;
  onClick(theme: Theme) {
    this.theme = theme;
    let theTheme: Theme = theme;
    this.cModeService.setTheme(theTheme);
  }
}