watercolor-ui
Version:
A modern minimalist cross-framework component library
167 lines • 5.37 kB
TypeScript
export interface ColorPalette {
50: string;
100: string;
200: string;
300: string;
400: string;
500: string;
600: string;
700: string;
800: string;
900: string;
950: string;
}
export interface FontConfig {
chinese?: string;
english?: string;
fallback?: string;
}
export interface RadiusConfig {
sm?: string;
md?: string;
lg?: string;
xl?: string;
'2xl'?: string;
full?: string;
}
export interface WatercolorTheme {
primary: Partial<ColorPalette>;
secondary?: Partial<ColorPalette>;
neutral?: Partial<ColorPalette>;
success?: Partial<ColorPalette>;
warning?: Partial<ColorPalette>;
error?: Partial<ColorPalette>;
info?: Partial<ColorPalette>;
danger?: Partial<ColorPalette>;
purple?: Partial<ColorPalette>;
pink?: Partial<ColorPalette>;
teal?: Partial<ColorPalette>;
indigo?: Partial<ColorPalette>;
fonts?: FontConfig;
radius?: RadiusConfig;
}
/**
* 通过读取到的json设置主题颜色和字体
* Set theme colors and fonts
* @param theme Theme configuration object
*/
export declare function setTheme(theme: WatercolorTheme): void;
/**
* Apply CSS class theme (deprecated - now using file-based themes)
* @deprecated Use loadThemeConfig() instead for file-based themes
* @param themeName Theme name
*/
export declare function applyCSSTheme(_themeName: string): void;
/**
* Set font configuration
* @param fonts Font configuration object
*/
export declare function setFonts(fonts: FontConfig): void;
/**
* Toggle dark mode
* @param isDark Whether it's dark mode
*/
export declare function toggleDarkMode(isDark: boolean): void;
/**
* Get current dark mode status
*/
export declare function isDarkMode(): boolean;
/**
* 预定义主题配置 (已弃用 - 现在使用基于文件的主题系统)
* Predefined theme configurations (deprecated - now using file-based theme system)
* @deprecated Use theme.config.json file for theme configuration
*/
export declare const themes: {
readonly default: {
readonly primary: {
readonly 50: "#eff6ff";
readonly 100: "#dbeafe";
readonly 200: "#bfdbfe";
readonly 300: "#93c5fd";
readonly 400: "#60a5fa";
readonly 500: "#3b82f6";
readonly 600: "#2563eb";
readonly 700: "#1d4ed8";
readonly 800: "#1e40af";
readonly 900: "#1e3a8a";
};
readonly secondary: {
readonly 50: "#f3f4ff";
readonly 100: "#e5e7ff";
readonly 200: "#c7d2fe";
readonly 300: "#a5b4fc";
readonly 400: "#818cf8";
readonly 500: "#6366f1";
readonly 600: "#4f46e5";
readonly 700: "#4338ca";
readonly 800: "#3730a3";
readonly 900: "#312e81";
};
};
};
/**
* Apply theme configuration (deprecated - use file-based themes)
* @deprecated Use loadThemeConfig() instead for file-based themes
* @param themeName Theme name
*/
export declare function applyTheme(themeName: keyof typeof themes): void;
/**
* 预定义字体主题
* Predefined font themes
*/
export declare const fontThemes: {
readonly system: {
readonly english: "system-ui";
readonly chinese: "system-ui";
readonly fallback: "-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif";
};
readonly chinese: {
readonly chinese: "PingFang SC";
readonly english: "SF Pro Display";
readonly fallback: "\"PingFang SC\", \"Hiragino Sans GB\", \"Microsoft YaHei\", \"WenQuanYi Micro Hei\", sans-serif";
};
readonly modern: {
readonly english: "Inter";
readonly chinese: "Noto Sans SC";
readonly fallback: "\"Inter\", \"Noto Sans SC\", sans-serif";
};
readonly elegant: {
readonly english: "Poppins";
readonly chinese: "Source Han Sans";
readonly fallback: "\"Poppins\", \"Source Han Sans\", \"Noto Sans CJK SC\", sans-serif";
};
readonly readable: {
readonly english: "IBM Plex Sans";
readonly chinese: "IBM Plex Sans SC";
readonly fallback: "\"IBM Plex Sans\", \"IBM Plex Sans SC\", sans-serif";
};
readonly apple: {
readonly english: "SF Pro Display";
readonly chinese: "PingFang SC";
readonly fallback: "\"SF Pro Display\", \"PingFang SC\", -apple-system, BlinkMacSystemFont, sans-serif";
};
readonly google: {
readonly english: "Roboto";
readonly chinese: "Noto Sans SC";
readonly fallback: "\"Roboto\", \"Noto Sans SC\", sans-serif";
};
};
/**
* 应用预定义字体主题
* Apply predefined font theme
* @param fontThemeName Font theme name
*/
export declare function applyFontTheme(fontThemeName: keyof typeof fontThemes): void;
/**
* 获取当前字体配置
* Get current font configuration
*/
export declare function getCurrentFonts(): FontConfig;
/**
* 动态加载根目录的 theme.config.json 并应用
* 该配置文件允许最终用户无需修改style.css即可自定义主题。
* Dynamic load theme.config.json and apply theme
* @param configPath 配置文件路径
*/
export declare function loadThemeConfig(configPath?: string): Promise<void>;
//# sourceMappingURL=theme.d.ts.map