@lobehub/chat
Version:
Lobe Chat - an open-source, high-performance chatbot framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.
22 lines (16 loc) • 651 B
text/typescript
import { useWatchBroadcast } from '@lobechat/electron-client-ipc';
import { useTheme } from 'antd-style';
import { rgba } from 'polished';
import { useEffect } from 'react';
import { useGlobalStore } from '@/store/global';
export const useWatchThemeUpdate = () => {
const switchThemeMode = useGlobalStore((s) => s.switchThemeMode);
const token = useTheme();
useWatchBroadcast('themeChanged', ({ themeMode }) => {
switchThemeMode(themeMode, { skipBroadcast: true });
});
useEffect(() => {
document.documentElement.style.background = 'none';
document.body.style.background = rgba(token.colorBgLayout, 0.66);
}, [token]);
};