feature: 新增全局主题系统(浅色/深色/跟随系统)、主题持久化与主题切换组件

This commit is contained in:
xiamuceer-j
2026-03-06 14:12:18 +08:00
parent 2d15b43915
commit f13dd26404
8 changed files with 328 additions and 35 deletions
+11
View File
@@ -0,0 +1,11 @@
import { useContext } from 'react';
import { ThemeModeContext } from './themeContext';
import type { ThemeContextValue } from './themeContext';
export const useThemeMode = (): ThemeContextValue => {
const context = useContext(ThemeModeContext);
if (!context) {
throw new Error('useThemeMode 必须在 ThemeProvider 内使用');
}
return context;
};