@arsedizioni/ars-utils 18.2.277 → 18.2.279

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1937,14 +1937,14 @@ class ThemeService {
1937
1937
  /**
1938
1938
  * The current theme is "System default"
1939
1939
  */
1940
- this.auto = computed(() => this.theme() === 'system');
1940
+ this.auto = computed(() => this.theme() === 'auto');
1941
1941
  /**
1942
1942
  * Configuration schema about the icon, the text and the toggle() sequence
1943
1943
  */
1944
1944
  this.themeInfo = {
1945
- ['system']: { icon: 'contrast', name: 'Impostazione predefinita di sistema', next: 'light', tooltip: 'Passa a tema chiaro', },
1945
+ ['auto']: { icon: 'contrast', name: 'Impostazione predefinita di sistema', next: 'light', tooltip: 'Passa a tema chiaro', },
1946
1946
  ['light']: { icon: 'light_mode', name: 'Tema chiaro', next: 'dark', tooltip: 'Passa a tema scuro', },
1947
- ['dark']: { icon: 'dark_mode', name: 'Tema scuro', next: 'system', tooltip: 'Passa a tema predefinito di sistema', },
1947
+ ['dark']: { icon: 'dark_mode', name: 'Tema scuro', next: 'auto', tooltip: 'Passa a tema predefinito di sistema', },
1948
1948
  };
1949
1949
  /**
1950
1950
  * Icon of the current theme (mat-icon code)
@@ -1980,7 +1980,7 @@ class ThemeService {
1980
1980
  * Set the new theme
1981
1981
  * @param theme the new theme
1982
1982
  */
1983
- setTheme(theme = 'system') {
1983
+ setTheme(theme = 'auto') {
1984
1984
  this.renderer.removeClass(document.body, 'light');
1985
1985
  this.renderer.removeClass(document.body, 'dark');
1986
1986
  this.theme.set(theme);
@@ -1995,6 +1995,15 @@ class ThemeService {
1995
1995
  toggleTheme() {
1996
1996
  this.setTheme(this.themeInfo[this.theme()].next);
1997
1997
  }
1998
+ /**
1999
+ * Get current active theme
2000
+ * @returns the current theme
2001
+ */
2002
+ getTheme() {
2003
+ return (this.auto()
2004
+ ? (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light")
2005
+ : this.theme());
2006
+ }
1998
2007
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: ThemeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1999
2008
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: ThemeService, providedIn: "root" }); }
2000
2009
  }