feature: 新增全局主题系统(浅色/深色/跟随系统)、主题持久化与主题切换组件
This commit is contained in:
@@ -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;
|
||||
};
|
||||
Reference in New Issue
Block a user