From bd4060e002e85448b3c9f7e3ed55c656fa67fec7 Mon Sep 17 00:00:00 2001 From: fretuks Date: Wed, 15 Apr 2026 22:11:42 +0200 Subject: [PATCH] fix dark mode styling --- public/market.js | 5 + public/script.js | 7 ++ public/settings.html | 7 ++ public/settings.js | 13 ++ public/style.css | 275 ++++++++++++++++++++++++++++--------------- 5 files changed, 209 insertions(+), 98 deletions(-) diff --git a/public/market.js b/public/market.js index 7657758..286c9ba 100644 --- a/public/market.js +++ b/public/market.js @@ -104,6 +104,10 @@ function applyTheme(themeKey) { }); } +function applyThemeMode(modeKey) { + document.body.dataset.themeMode = modeKey === "dark" ? "dark" : "light"; +} + function setMarketStatus(message, state = "") { marketStatus.textContent = message; marketStatus.className = state ? `status persona-status ${state}` : "status persona-status"; @@ -701,6 +705,7 @@ marketPersonaForm.addEventListener("submit", (event) => { window.addEventListener("load", async () => { applyTheme(localStorage.getItem("krishd-theme") || "fakegpt"); + applyThemeMode(localStorage.getItem("krishd-theme-mode") || "light"); const params = new URLSearchParams(window.location.search); setMarketSort("assistant", params.get("assistantSort") || "best", {reload: false}); setMarketSort("user", params.get("userSort") || "best", {reload: false}); diff --git a/public/script.js b/public/script.js index bac4e1b..615a27c 100644 --- a/public/script.js +++ b/public/script.js @@ -858,6 +858,12 @@ function applyTheme(themeKey, persist = true) { renderModelSection(); } +function applyThemeMode(modeKey, persist = true) { + const nextMode = modeKey === "dark" ? "dark" : "light"; + document.body.dataset.themeMode = nextMode; + if (persist) localStorage.setItem("krishd-theme-mode", nextMode); +} + function updateChatActionState() { const activeChat = getChatById(activeChatId); const hasChat = Boolean(activeChat); @@ -1742,6 +1748,7 @@ document.addEventListener("keydown", (event) => { }); window.addEventListener("load", async () => { applyTheme(localStorage.getItem("krishd-theme") || "fakegpt", false); + applyThemeMode(localStorage.getItem("krishd-theme-mode") || "light", false); applyWorkspaceMode(localStorage.getItem("krishd-workspace-mode") || "basic", false); setNotice("Ready."); updateChatActionState(); diff --git a/public/settings.html b/public/settings.html index 0686dd7..4b22d23 100644 --- a/public/settings.html +++ b/public/settings.html @@ -122,6 +122,13 @@ +