mirror of
https://github.com/algerkong/AlgerMusicPlayer.git
synced 2026-05-17 10:27:30 +08:00
🦄 refactor: 重构整个项目 优化打包 修改后台服务为本地运行 添加更新版本检测功能
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
export type ThemeType = 'dark' | 'light';
|
||||
|
||||
// 应用主题
|
||||
export const applyTheme = (theme: ThemeType) => {
|
||||
// 使用 Tailwind 的暗色主题类
|
||||
if (theme === 'dark') {
|
||||
document.documentElement.classList.add('dark');
|
||||
} else {
|
||||
document.documentElement.classList.remove('dark');
|
||||
}
|
||||
|
||||
// 保存主题到本地存储
|
||||
localStorage.setItem('theme', theme);
|
||||
};
|
||||
|
||||
// 获取当前主题
|
||||
export const getCurrentTheme = (): ThemeType => {
|
||||
return (localStorage.getItem('theme') as ThemeType) || 'light';
|
||||
};
|
||||
Reference in New Issue
Block a user