Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

🐛 fix(desktop): keep the window background in sync after a system theme switch (#21894)

Innei3eb8372c29be
diff --git a/src/styles/global.ts b/src/styles/global.ts
index 89c68254c1f..88b9ba8706f 100644
--- a/src/styles/global.ts
+++ b/src/styles/global.ts
@@ -1,5 +1,4 @@
-import type { LobeTheme } from '@lobehub/ui';
-import { CLASSNAMES, css } from '@lobehub/ui';
+import { CLASSNAMES, css, cssVar } from '@lobehub/ui';
import { CONVERSATION_PRINT_ROOT_CLASS } from '@/features/Conversation/ChatList/constants';
import {
@@ -10,7 +9,7 @@ import {
// fix ios input keyboard
// overflow: hidden;
// ref: https://zhuanlan.zhihu.com/p/113855026
-const genGlobalStyle = ({ token }: { prefixCls: string; token: LobeTheme }) => css`
+const genGlobalStyle = () => css`
html,
body,
#__next {
@@ -41,7 +40,7 @@ const genGlobalStyle = ({ token }: { prefixCls: string; token: LobeTheme }) => c
}
* {
- scrollbar-color: ${token.colorFill} transparent;
+ scrollbar-color: ${cssVar.colorFill} transparent;
scrollbar-width: thin;
::-webkit-scrollbar {
@@ -55,7 +54,7 @@ const genGlobalStyle = ({ token }: { prefixCls: string; token: LobeTheme }) => c
:hover::-webkit-scrollbar-thumb {
border: 3px solid transparent;
- background-color: ${token.colorText};
+ background-color: ${cssVar.colorText};
background-clip: content-box;
}
@@ -71,19 +70,19 @@ const genGlobalStyle = ({ token }: { prefixCls: string; token: LobeTheme }) => c
}
html.desktop[data-theme='dark'] body {
- background-color: color-mix(in srgb, ${token.colorBgLayout} 50%, transparent);
+ background-color: color-mix(in srgb, ${cssVar.colorBgLayout} 50%, transparent);
}
html.desktop[data-theme='light'] body {
- background-color: color-mix(in srgb, ${token.colorBgLayout} 70%, transparent);
+ background-color: color-mix(in srgb, ${cssVar.colorBgLayout} 70%, transparent);
}
${MAC_WINDOW_FULLSCREEN_SELECTOR} {
- ${MAC_PANEL_BG_VAR}: ${token.colorBgLayout};
+ ${MAC_PANEL_BG_VAR}: ${cssVar.colorBgLayout};
}
${MAC_WINDOW_FULLSCREEN_SELECTOR} body {
- background-color: ${token.colorBgLayout};
+ background-color: ${cssVar.colorBgLayout};
}
button {
@@ -92,7 +91,7 @@ const genGlobalStyle = ({ token }: { prefixCls: string; token: LobeTheme }) => c
.${CLASSNAMES.ContextTrigger}[data-popup-open]:not([data-no-highlight]),
.${CLASSNAMES.DropdownMenuTrigger}[data-popup-open]:not([data-no-highlight]) {
- background: ${token.colorFillTertiary};
+ background: ${cssVar.colorFillTertiary};
}
.accordion-action:has(
.${CLASSNAMES.DropdownMenuTrigger}[data-popup-open]:not([data-no-highlight])
diff --git a/src/styles/index.ts b/src/styles/index.ts
index 614261008eb..6832e0a695e 100644
--- a/src/styles/index.ts
+++ b/src/styles/index.ts
@@ -2,9 +2,7 @@ import { createGlobalStyle } from '@lobehub/ui';
import global from './global';
-const prefixCls = 'ant';
-
-export const GlobalStyle = createGlobalStyle(({ theme }) => [global({ prefixCls, token: theme })]);
+export const GlobalStyle = createGlobalStyle(() => [global()]);
export { shinyTextStyles } from './loading';
export * from './text';