浏览代码

fix: taskbar color follow(#54)

AprilNEA 1 年之前
父节点
当前提交
cd73c3a7cb
共有 1 个文件被更改,包括 8 次插入0 次删除
  1. 8 0
      app/components/home.tsx

+ 8 - 0
app/components/home.tsx

@@ -358,12 +358,20 @@ function useSwitchTheme() {
   const config = useChatStore((state) => state.config);
 
   useEffect(() => {
+    const metaDescription = document.querySelector('meta[name="theme-color"]');
+
     document.body.classList.remove("light");
     document.body.classList.remove("dark");
     if (config.theme === "dark") {
       document.body.classList.add("dark");
+      if (metaDescription){
+        metaDescription.setAttribute('content', "#151515");
+      }
     } else if (config.theme === "light") {
       document.body.classList.add("light");
+      if (metaDescription){
+        metaDescription.setAttribute('content', "#fafafa");
+      }
     }
   }, [config.theme]);
 }