zhengyiming
2025-02-10 958b79ed89b9e742540f714a80261d222c0fc09b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { ThemeColorsType, ThemeColorName } from '@/constants';
import { Theme } from '@bole-core/theme';
 
export class ThemeManager {
  private static ThemeInstance: Theme<ThemeColorName>;
 
  public static getThemeInstance() {
    if (!this.ThemeInstance) {
      this.ThemeInstance = new Theme();
    }
    return this.ThemeInstance;
  }
 
  static init(themeColors: ThemeColorsType) {
    this.getThemeInstance().init(themeColors);
  }
 
  static setThemeColors(themeColors: ThemeColorsType) {
    this.getThemeInstance().setThemeColors(themeColors);
  }
 
  static getThemeColors() {
    return this.getThemeInstance().getThemeColors();
  }
 
  static getThemeMap() {
    return this.getThemeInstance().getThemeMap();
  }
 
  static getStorageThemeName(): keyof ThemeColorsType {
    return this.getThemeInstance().getStorageThemeName() ?? 'default';
  }
 
  static setTheme(themeName: keyof ThemeColorsType) {
    this.getThemeInstance().setTheme(themeName);
  }
}