dm-vue3-ui
Version:
This Components Library will help get you started developing in Vue 3.
71 lines (70 loc) • 1.64 kB
TypeScript
/**
* 主题管理器 - 处理动态主题切换,兼容vite.config中的customTheme
*/
export interface ThemeConfig {
primaryColor: string;
borderRadius?: string;
borderColor?: string;
}
export type ThemeType = 'default' | 'blue';
export interface ThemeOption {
value: ThemeType;
name: string;
color: string;
config: ThemeConfig;
}
export declare class ThemeManager {
private static instance;
private currentTheme;
private originalTheme;
private themeConfigs;
private constructor();
static getInstance(): ThemeManager;
/**
* 应用主题配置
* @param theme 主题配置
*/
applyTheme(theme: Partial<ThemeConfig>): void;
/**
* 根据主题类型应用主题
* @param themeType 主题类型
*/
applyThemeByType(themeType: ThemeType): ThemeConfig;
/**
* 获取所有可用主题选项
*/
getThemeOptions(): ThemeOption[];
/**
* 重置为原始主题
*/
resetTheme(): void;
/**
* 初始化主题 - 从localStorage读取保存的主题色
*/
initializeTheme(): void;
/**
* 获取当前主题配置
*/
getCurrentTheme(): ThemeConfig;
/**
* 更新CSS变量
*/
private updateCSSVariables;
/**
* 更新Ant Design主题变量
*/
private updateAntdThemeVariables;
/**
* 注入动态样式
*/
private injectDynamicStyles;
/**
* 调整颜色亮度
*/
private adjustColorBrightness;
/**
* 十六进制颜色转RGBA
*/
private hexToRgba;
}
export declare const themeManager: ThemeManager;