这是一个简单的主题管理插件,允许用户在浅色模式、深色模式及自定义主题之间切换,并实时调整主题的 CSS 变量。该插件通过加载 JSON 配置文件来管理不同的主题样式,并提供了便捷的界面让用户动态更改颜色。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

13 lines
595 B

export type Theme = Record<string, string>;
export type Themes = Record<string, Theme>;
export interface ThemeManager {
themes: Record<string, Record<string, string>>;
currentTheme: string;
eventListeners: Array<(theme: string) => void>;
loadThemesFromJSON: (url: string) => Promise<void>;
switchTheme: (themeName: string) => void;
onThemeChange: (callback: (theme: string) => void) => void;
setThemeVariable: (variable: string, value: string) => void;
addThemeVariable: (themeName: string, variable: string, value: string) => void;
applyTheme: () => void;
}