@difizen/mana-core
Version:
50 lines • 1.79 kB
TypeScript
import type { Event } from '@difizen/mana-common';
import { Emitter, Disposable } from '@difizen/mana-common';
import type { StorageService } from '../common';
import './style/theme-base.less';
export declare const ThemeServiceSymbol: unique symbol;
export type ThemeType = 'light' | 'dark' | 'hc';
export type TokenValue = string | undefined;
export interface ExtraTokens {
basic?: Record<string, TokenValue>;
color?: Record<string, TokenValue>;
[key: string]: Record<string, TokenValue> | undefined;
}
export interface Theme {
readonly id: string;
readonly type: ThemeType;
readonly label: string;
readonly description?: string;
readonly extraTokens?: ExtraTokens;
}
export interface ThemeChangeEvent {
readonly newTheme: Theme;
readonly oldTheme?: Theme | undefined;
}
export declare class BuiltinThemeProvider {
static readonly darkTheme: Theme;
static readonly lightTheme: Theme;
static readonly hcTheme: Theme;
static readonly themes: Theme[];
}
export declare class ThemeService {
protected themes: Record<string, Theme>;
protected activeTheme: Theme | undefined;
protected storageService: StorageService;
protected readonly themeChange: Emitter<ThemeChangeEvent>;
readonly onDidColorThemeChange: Event<ThemeChangeEvent>;
get themeClassName(): string;
constructor();
static get(): ThemeService;
startupTheme(): void;
register(...themes: Theme[]): Disposable;
protected validateActiveTheme(): void;
getThemes(): Theme[];
getTheme(themeId: string): Theme;
setCurrentTheme(themeId: string, tokens?: ExtraTokens): void;
getCurrentTheme(): Theme;
getActiveTheme(): Theme;
get defaultTheme(): Theme;
reset(): void;
}
//# sourceMappingURL=theme-service.d.ts.map