Files
zgty-mas-m/sheep/utils/theme.js
2025-09-30 00:08:23 +08:00

49 lines
963 B
JavaScript

import themeConfig from '@/sheep/config/theme.js';
/**
* 主题管理工具类 - 简化版,只提供主题色配置
*/
class ThemeManager {
constructor() {
this.config = themeConfig;
}
/**
* 获取当前主题色
*/
getCurrentThemeColor() {
return this.config.primary.main;
}
/**
* 获取主题渐变
* @param {string} type - 渐变类型 horizontal|vertical|diagonal
*/
getGradient(type = 'horizontal') {
return this.config.gradients[type] || this.config.gradients.horizontal;
}
/**
* 获取主题色变体
*/
getThemeColors() {
return {
main: this.config.primary.main,
light: this.config.primary.light,
dark: this.config.primary.dark,
gradient: this.config.primary.gradient
};
}
/**
* 获取CSS变量
*/
getCSSVars() {
return this.config.getCSSVars();
}
}
// 创建全局实例
const themeManager = new ThemeManager();
export default themeManager;